Using the lpr Command from the Unix Command Line

The lpr command referred to here is specific to Solaris hosts only in the Student or General computing regions and specific research hosts.

Unix users can view documentation on how to use the lpr command by typing man lpr to see the options that are available to use with the lpr command, including the -Z options, which allows you to fit n logical pages (also known as n-up printing) on a physical sheet of paper. For example,

lpr -Fl -Plj_cs -Z2d file.ps
tells lpr to print the postscript file.ps on both sides of the sheet (d part is responsible) and to print two pages on side (the 2 indicates this) of the sheet of paper to the print queue lj_cs. Note the presence of the -Fl directive which tells lpr that file.ps is to be interpreted as a Postscript file, normally this option is not needed needed as the system will scan the file to determine what type it is but sometimes files can get corrupted and this auto detection method can get fooled. The result can be a pile of pages where the Postscript file is treated as a text file, not what you want as its gibberish to the human eye and results in a huge stack of wasted paper. So to be on the safe side, use -Fl option if you know the file is a Postscript file (NOTE. If a .ps file was created with specific formatting settings embedded in it, you may not be able to override them with the aforementioned command line options).

Ordinary text files, for example, a file created with text editor like vi, emacs, or pico be printed in the same way a Postscript file can be printed, namely

lpr -Plj_cs textfile
The system will convert the file to postscript and send that to the printer.

Dvi files as produced by the latex and tex command can be printed directly by using the -Fd option as opposed to the -Fl. Unfortunately this approach sometimes results poor output because of obscure font issues and depending on what specific printer is used.. It may well be better to use pdflatex and then view the resulting pdf file with acroread and use acroread to print the file. Acroread allows one to specify lpr as a Print Command.

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r2 - 2006-05-10 - WalterTautz
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback