Command-line Printing

Command-line options

Most of our printers can handle advanced job modification options and can print non-PostScript files like PDF and JPEG without requiring manual conversion by the user. The job options allow one to specify a subset of pages to print, output order, the number of document pages printed on a single printed page, and more. To see all of these options, please refer to http://www.cups.org/sum.html#4_3.

Here is a partial list of options:

  • lpr filename
  • lpr -P printer filename
  • lpr -o landscape -o scaling=75 -o media=A4 filename.jpg
  • lpr -#num-copies filename
  • lpr -#num-copies -o Collate=True filename
  • lpr -o media=Letter,Transparency filename
  • lpr -o media=Letter,MultiPurpose,Transparency filename
  • lpr -o landscape filename
  • lpr -o portrait filename
  • lpr -o sides=one-sided filename
  • lpr -o sides=two-sided-long-edge filename
  • lpr -o job-sheets=classified,classified filename
  • lpr -o page-ranges=1-4,7,9-12 filename
  • lpr -o page-set=even filename
  • lpr -o outputorder=reverse filename
  • lpr -o number-up=4 filename
  • lpr -o number-up=16 filename
  • lpr -o mirror filename
  • lpr -o brightness=120 filename
  • lpr -o gamma=1700 filename
  • lpr -o cpi=17 filename
  • lpr -o lpi=8 filename
  • lpr -o columns=3 filename
  • lpr -o page-bottom=value filename
  • lpr -o prettyprint filename
  • lpr -o natural-scaling=percent filename
  • lpr -o hue=value filename
  • lpr -o saturation=percent filename
  • lpr -o blackplot filename
  • lpr -o fitplot filename
  • lpr -o penwidth=value filename
  • lpr -o raw filename
  • lpr -l filename

Examining the queue

The printing system will often enqueue, dequeue, and delivers a job to the printer before you have a chance to see that it has actually arrived on the queue. This may lead you to believe that your job hasn't printed since 'lpq' won't show your job when in fact it has already been accepted by the printer. To view a list of jobs that the printer has already received, run 'lpstat -W completed -o PRINTER' where PRINTER is where you sent your job. You can also run 'lpstat -W completed -u USERNAME' to see all jobs completed by the user USERNAME.

Printer aliases

It is possible to create a printer alias using a list of options so that if you send a job to the printer alias, it is modified by the options specified in the alias.

For instance, the command 'lpoptions -p 491/4s -o sides=one-sided -o number-up=4' creates the printer alias 491/4s with the options for simplex and 4-up printing. If one then sends a job to 491/4s without any additional options, e.g. 'lpr -P 491/4s' the job will be automatically simplexed and 4-upped. These options are saved to the file '~/.lpoptions'.

You must always specify a printer alias using the slash (/) character.

Printing in landscape mode

To print plain text in landscape mode use the command 'enscript' with the '-r' option. TeX output can be printed using the '-t landscape' option of 'dvips'. PostScript can be printed using the '-r' option of 'psnup'. For example, "psnup -n1 -r file.ps".