2010-08-24

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.

copies=num
Number of copies. Also possible to use -#num but that might need escaping.
landscape
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.
number-up=num
The number of pages to print on each side.
number-up-layout=lrtb|lrbt|rltb|rlbt|tblr|tbrl|btlr|btrl
Choose how the pages are laid out when printing multiple pages on a side.
sides=one-sided|two-sided-long-edge|two-sided-short-edge
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.
media=A4|whatever
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.
page-set=odd|even
Print only odd or even pages.
outputorder=normal|reverse
This takes effect after number-up so you still get 1234 on a page, not 4321
cpi=charsperinch
The number of characters per inch when printing plain text (default 10).
lpi=linesperinch
The number of lines per inch when printing plain text (default 6).
columns=num
The number of columns to format when printing plain text.
page-(left|right|top|bottom)=margin
The margin sizes in points when printing plain text.
Collate=true|false
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.
page-ranges=page,page,start-end
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