I noticed that printing the exact same pdf file to the exact same printer does not always take the same amount of time:
lpr
has the same effect as printing from Chrome's built-in print dialog.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:
In my case, I looked at
lpoptions -p printerName -l
to see all the options and discovered that one of the defaults didn't match my setup. Fixed it with-o paramName=paramValue
in my command and it printed smoothly as ever.
Original answer:
If you haven't already, try the following:
-H immediate
for the lpr
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:
CUPS provides many ways to set the default destination. The LPDEST and PRINTER environment variables are consulted first. If neither are set, the current default set using the lpoptions(1) command is used, followed by the default set using the lpadmin(8) command.
And from lpoptions
manpage:
~/.cups/lpoptions - user defaults and instances created by non-root users.
/etc/cups/lpoptions - system-wide defaults and instances created by the root user.
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 calling lp
or lpr
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
and lpr
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.