Options for lpr

I keep on forgetting these so it's about time I wrote down the ones I use most often.

You can list the current options (it definitely includes the options I've set to default and I'm not sure if it also shows all other default options or just those which the Cups Gui on my machine has set) with lpoptions. I've set it to print full duplex by default in the past with lpoptions -o sides=two-sided-long-edge so that shows up when I run loptions and everything's printed double sided by default.

Sometimes I don't want to print double sided and so I'll do lpr flyer.pdf -o copies=8 -o sides=one-sided to print off a bunch, one per sheet. (Could also do -#8 as on option to lpr for eight copies but that requires escaping.)

I can also choose a printer other than the default one such as the colour laser with lpr poster.pdf -P renoir

To do a quick printout of a PDF 2-up and reordered so it can just be folded up into a pamphlet fresh out of the printer I can do this:

pdftops somebook.pdf - | psbook | lpr -o number-up=2 -o sides=two-sided-short-edge

To print an A4 page on an A3 printer and fill the page I should (not tested) be able to do this:

lpr a4poster.pdf -o media=A3 -o fit-to-page

A landscape option might be necessary, I guess depending on the input. I'll come back and confirm what works at some point.

Number of copies. Also possible to use -#num but that might need escaping.
Rotates 90 degrees but doesn't resize the page. Printing an A4 portrait PDF will not fit on A4 media but it doesn't complain, it just cuts off what doesn't fit.
The number of pages to print on each side.
Choose how the pages are laid out when printing multiple pages on a side.
Choose how duplex works -- how the paper is turned over before the next page is printed. two-sided-long-edge is desirable for 1-up printing, two-sided-short-edge for 2-up.
Choose the media size. If the printer only does as large as A4 and you tell it to use A3 and fit-to-page it'll print on A4, sideways and too big. Doesn't sound useful but it potentially is.
Print only odd or even pages.
This takes effect after number-up so you still get 1234 on a page, not 4321
The number of characters per inch when printing plain text (default 10).
The number of lines per inch when printing plain text (default 6).
The number of columns to format when printing plain text.
The margin sizes in points when printing plain text.
Whether or not to collate the output pages -- that is, print all pages of the first copy followed by all pages of the next. By default it won't -- it'll print all copies of page 1, then all copies of page 2 and so on.
Choose which pages to print. This takes effect after number-up so the second page is 5678 when printing 4-up. They're always printed in ascending order, regardless of the order the ranges are given in.

No comments:

Post a comment