1. Marcin Kasperski
  2. script_print


script_print /

Filename Size Date modified Message
46 B
1.0 KB
4.4 KB


Print given .pdf file in pieces, 20 (or whatever you specify) pages each, waiting until printer finishes previous part before feeding it with the next one.

I wrote it to handle repeatable problems with my printer hanging, crashing, or working very slowly when asked to print large graphics-intensive PDFs.

Simplest usage (print whole bigfile.pdf in chunks of 20 pages):

perl print_in_parts.pl --file=bigfile.pdf

More complicated usage:

perl print_in_parts.pl --file=bigfile.pdf --since=41 --split=10

(print, in chunks of 10 pages, part of bigfile.pdf starting from page 41)

Requires modern Linux printing tools (lp and lpstat, I test the script on Ubuntu with CUPS). Uses default printer configured on the machine, claims A4 page size, and requests two-side printing. Those options (printer, page size, duplex) can be fine-tuned if necessary by editing printing command in the script code.

Requires also perl plus Moose, MooseX::Getopt, and PDF::API2 modules.