User Tools

Site Tools


printing:lpr:advanced

This is an old revision of the document!


LPR Advanced Use

Setting Default Options

The printing options below can be used to set default options for future print jobs. Use the lpoptions command with the same arguments below. 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
The default queue

Normally the default printer used by the system is the nearer to the workstation, but sometime you can desire a different behaviour. To change your default printer you use the lpoptions command. If you want change your default printer to cloud you can use:

  $ lpoptions -d cloud

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
  • The -o number-up=value option selects N-Up printing. N-Up printing places multiple document pages on a single printed page. CUPS supports 1, 2, 4, 6, 9, and 16-Up formats; the default format is 1-Up:
$ lpr -o number-up=1 filename ENTER
$ lpr -o number-up=2 filename ENTER
$ lpr -o number-up=4 filename ENTER
$ lpr -o number-up=16 filename ENTER
  • 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
  • The -o page-border=value option chooses the border to draw around each page:
$ lpr -o page-border=double; draw two hairline borders around each page
$ lpr -o page-border=double-thick; draw two 1pt borders around each page
$ lpr -o page-border=none; do not draw a border (default)
$ lpr -o page-border=single; draw one hairline border around each page
$ lpr -o page-border=single-thick; draw one 1pt border around each page
  • The -o number-up-layout=value option chooses the layout of the pages on each output page:
$ lpr -o number-up-layout=btlr; Bottom to top, left to right
$ lpr -o number-up-layout=btrl; Bottom to top, right to left
$ lpr -o number-up-layout=lrbt; Left to right, bottom to top
$ lpr -o number-up-layout=lrtb; Left to right, top to bottom (default)
$ lpr -o number-up-layout=rlbt; Right to left, bottom to top
$ lpr -o number-up-layout=rltb; Right to left, top to bottom
$ lpr -o number-up-layout=tblr; Top to bottom, left to right
$ lpr -o number-up-layout=tbrl; Top to bottom, right to left  * Setting the Output Order
  • You can mirror a print using the -o mirror option:
$ lpr -o mirror filename ENTER
  • The -o outputorder=order option to set the output order of all pages:
$ lpr -o outputorder=normal filename ENTER
$ lpr -o outputorder=reverse filename ENTER
  • 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, 2, 2, 3, 3, 4, 4 …

Text Printing Options

The following options apply when printing text files.

  • The -o cpi=value option sets the number of characters per inch:
$ lpr -o cpi=10 filename ENTER
$ lpr -o cpi=12 filename ENTER
$ lpr -o cpi=17 filename ENTER
The default characters per inch is 10.
  • The -o lpi=value option sets the number of lines per inch:
$ lpr -o lpi=6 filename ENTER
$ lpr -o lpi=8 filename ENTER
The default lines per inch is 6.
  • The -o columns=value option sets the number of text columns:
$ lpr -o columns=2 filename ENTER
$ lpr -o columns=3 filename ENTER
The default number of columns is 1.
  • Setting the Page Margins

Normally the page margins are set to the hard limits of the printer. Use the -o page-left=value, -o page-right=value , -o page-top=value, and -o page-bottom=value options to adjust the page margins:

$ lpr -o page-left=value filename ENTER
$ lpr -o page-right=value filename ENTER
$ lpr -o page-top=value filename ENTER
$ lpr -o page-bottom=value filename ENTER
The value argument is the margin in points; each point is 1/72 inch or 0.35mm.
  • Pretty Printing

The -o prettyprint option puts a header at the top of each page with the page number, job title (usually the filename), and the date. Also, C and C++ keywords are highlighted, and comment lines are italicized:

lpr -o prettyprint filename ENTER

$ 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%) 
  • Selecting the Media Size, Type, and Source

The -o media=xyz option sets the media size, type, and/or source:

$ lpr -o media=Letter,Transparency filename ENTER
$ lpr -o media=Letter,MultiPurpose,Transparency filename ENTER

The available media sizes, types, and sources depend on the printer, but most support the following options (case is not significant):

  • Letter - US Letter (8.5×11 inches, or 216x279mm)
  • Legal - US Legal (8.5×14 inches, or 216x356mm)
  • A4 - ISO A4 (8.27×11.69 inches, or 210x297mm)
  • COM10 - US #10 Envelope (9.5×4.125 inches, or 241x105mm)
  • DL - ISO DL Envelope (8.66×4.33 inches, or 220x110mm)
  • Transparency - Transparency media type or source
  • Upper - Upper paper tray
  • Lower - Lower paper tray
  • MultiPurpose - Multi-purpose paper tray
  • LargeCapacity - Large capacity paper tray

The actual options supported are defined in the printer's PPD file in the PageSize, InputSlot, and MediaType options. You can use the command

$ lpoptions -p <name of printer> -l 

to see all the options available

printing/lpr/advanced.1169746877.txt.gz · Last modified: 2007/01/25 17:41 by damir