User Tools

Site Tools


printing:lpr:advanced

This is an old revision of the document!


lpr advanced use

lpr options

By using options in the command line of the command lpr you can have output completely different from the onew with standard configuration. Using these options you can print until 32 pages of docs in a single sheet of paper, select the level of resolution, change the orientation of the page, and so on. Nobody is able to remember all the options available, so here are listed some useful option you can use.

  • Printing non text/postscript documents from the command line
$ lpr acrobatdocument.pdf
  • Setting Duplex Printing (two-sided-long-edge is default)
$ lpr -o sides=one-sided mydocument
$ lpr -o sides=two-sided-long-edge mydocument
$ lpr -o sides=two-sided-short-edge mydocument
  • Setting the media type (duplex is on by default, so turn it off)
$ lpr -o media=Transparency -o sides=one-sided mydocument
$ lpr -o media=Letterhead -o sides=one-sided mydocument
  • Print on Letterhead for first page, Plain for remaining pages
$ lpr -o sides=one-sided -o 1:media=Letterhead -o media=Plain mydocument
  • Print multiple document pages on a printed page (N-Up)
$ lpr -o number-up=2 mydocument
$ lpr -o number-up=4 mydocument
  • Print only odd or even pages
$ lpr -o page-set=odd mydocument
$ lpr -o page-set=even mydocument
  • Print page ranges
$ lpr -o page-ranges=5 mydocument
$ lpr -o page-ranges=2-5 mydocument
$ lpr -o page-ranges=2-5,7-9 mydocument
  • Rotate page
$ lpr -o landscape mydocument
  • Set the percentage brightness
$ lpr -o brightness=120 mydocument
  • Set the Gamma correction, 1000 is normal.
$ lpr -o gamma=1700 mydocument
  • Print multiple copies
$ lpr -n num_copies -o collate=True mydocument

With the collate option set True, the pages of your documents will be printed in this order: 1, 2, 3, 4 … 1, 2, 3, 4 … If you set the collate option to Off, the pages of your documents wil be printers in this order: 1, 1, 1, 2, 2, 3, 3, 4, 4 …

  • Text Printing Options
$ lpr -o prettyprint mydocument.txt
$ lpr -o cpi=10 mydocument.txt
$ lpr -o lpi=8 mydocument.txt
$ lpr -o columns=2 mydocument.txt
  • Setting Page Margins (in 1/72's of an Inch)
$ lpr -o page-left=72 -o page-right=72 -o page-top=72 -o page-bottom=72 mydocument.txt
  • Image Printing Options
$ lpr -o position=center myimage {center,top,left,right,top-left,top-right, bottom,bottom-left,bottom-right}
$ lpr -o scaling=100 myimage (1-800%)
$ lpr -o ppi=300 myimage (dots per inch)
$ lpr -o hue=-10 myimage (-360 to 360)
$ lpr -o saturation=110 myimage (0-200%) 
Setting Default Options

The printing options above can also be used to set default options for future print jobs. Use the lpoptions command with the same arguments above. The options will be saved in the .lpoptions file in your home directory. The following example will set 1/2“ margins and make text smaller:

$ lpoptions -o page-left=36 -o page-right=36 -o page-top=36 -o page-bottom=36
$ lpoptions -o cpi=12
$ lpoptions -o lpi=7
printing/lpr/advanced.1169725537.txt.gz · Last modified: 2007/01/25 11:45 by damir