Marcin Kasperski avatar Marcin Kasperski committed 60bd4f4

.

Comments (0)

Files changed (1)

print_in_parts.pl

 
 =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;
     system($command);
 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 |");
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.