I noticed that printing the exact same pdf file to the exact same printer does not always take the same amount of time:
- Printing from macOS preview's default printing dialog is very fast.
- Printing from Chrome browser's built-in print dialog is slower. The printer pauses for a moment after starting the print job.
- Printing from the command line with
lpr
has the same effect as printing from Chrome's built-in print dialog. - However, switching to the system printing dialog withing Chrome makes things fast again.
My goal is to make printing from the command line with lpr
as smooth as from the system's dialog. What could actually make the difference?
lpr -o landscape /path/to/my/file.pdf
is my current command. The generated output is as expected, just too slow.
Solution pulled up here from comments below:
Original answer:
If you haven't already, try the following:
-H immediate
for thelpr
command you use, to override any scheduling that might be happening in the CUPS queue itself.-d $printername
parameter to override any decisions about which printer to use.The manpage for
lp
gives us a little hint as to what may be happening:And from
lpoptions
manpage:Either of these locations may contain settings so check that you don't have any unexpected configuration sitting there.
Re: destination selection:
The selection of destination can probably be sped up somewhat by specifying a default destination using any of the means above. Declaring a default destination and then choosing that named destination with
-d
when callinglp
orlpr
seems to be the easiest way but the ENV variables are also quite handy.You should also use
lpoptions
to verify the options of your printer, if any are set to less than optimal values. Matching the options you use in the "normal" OSX printer settings here should cause the two printing methods to operate at the exact same speed.If that doesn't solve your problem the next step would be to find out which raw file formats your printer is the fastest at printing - and then try to emulate this by doing conversion on the command line and pass the converted file to the printer instead (note:
lp
andlpr
both support using STDIN as input). All things being equal, your computer is probably significantly faster at converting than the printer or print server you use, and Preview may be using a similar trick for example to print raw instead of actually passing the PDF file.