1. Marcin Kasperski
  2. script_print


Marcin Kasperski  committed 60bd4f4


  • Participants
  • Parent commits 24ac588
  • Branches default

Comments (0)

Files changed (1)

File print_in_parts.pl

View file
 =head1 print_in_parts.pl
-Print given .pdf or .ps file in pieces, 20 pages each, waiting for the
+Print given .pdf file in pieces, 20 pages each, waiting for the
 end of earlier part before sending next one.
 Requires modern Linux printing tools (lp and lpstat, I test the script
         die "Only .pdf files are currently handled.\nNote: support for .ps could be easily added if useful.\n";
+    # TODO: handle also .ps files. For those, pages count can be calculated
+    # using: 
+    #   gs -q -dBATCH -sDEVICE=nullpage source.ps | grep -c showpage
+    # or (faster but can fail for uglier files)  directly by counting 
+    #   %%Page:
+    # lines
     my $doc = PDF::API2->open($self->file);
     my $pages_count = $doc->pages;
     undef $doc;
     print "Printing pages $since-$to from $filename\n";
+    # TODO: make printer, media and duplex to be script options
     my $command = "lp -o media=a4 -o sides=two-sided-long-edge -P '$since-$to' '$filename'";
     print "Trying:\n$command\n" if $self->verbose;
 sub printer_active {
     my $self = shift;
+    # TODO: make printer an option
     print "Checking lpstat...\n" if $self->verbose;
     my $active = 0;
     open(my $fd, "lpstat |");