Using the Printing System

This chapter shows you how to submit, query, and cancel print jobs to different printers.

Submitting Files for Printing

CUPS provides both the System V (lp(1)) and Berkeley ( lpr(1)) printing commands. Type the following command to print a file to the default (or only) printer on the system:

CUPS understands many different types of files directly, including PostScript and image files. This allows you to print from inside your applications or at the command-line, whichever is most convenient!

Choosing a Printer

Many systems will have more than one printer available to the user. These printers can be attached to the local system via a parallel, serial, or USB port, or available over the network.

Use the lpstat(1) command to see a list of available printers:

The -p option specifies that you want to see a list of printers, and the -d option reports the current default printer or class.

Use the -P option with the lpr command to print to a specific printer:

Setting Printer Options

For many types of files, the default printer options may be sufficient for your needs. However, there may be times when you need to change the options for a particular file you are printing.

The  lpr commands allow you to pass printer options using the -o option:

Printing Multiple Copies

The lpr command has options for printing more than one copy of a file:

Copies are normally not collated for you. Use the -o Collate=True option to get collated copies :

Checking the Printer Status from the Command-Line

The lpstat command can be used to check for jobs that you have submitted for printing:

The jobs are listed in the order they will be printed. Use the -p option to see which files and printers are active:

Use the -o and -p options together to show the jobs and the printers:

Checking the Printer Status from the Web

Since CUPS uses the Internet Printing Protocol, it is also a fully-functional web server. To use your web browser to monitor the printers on your system, open the URL:

From there you can view the status of classes, jobs, and printers with the click of a button!

Canceling a Print Job

The cancel(1) and lprm(1) commands cancel a print job:

The job-id is the number that was reported to you by the lp or lpstat commands.

Standard Printer Options

This chapter describes the standard printer options that are available when printing with the lp and lpr commands.

General Options

The following options apply when printing all types of files.

Selecting the Media Size, Type, and Source

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

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

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

Setting the Orientation

The -o landscape option will rotate the page 90 degrees to print in landscape orientation:

Printing On Both Sides of the Paper

The -o sides=two-sided-short-edge and -o sides=two-sided-long-edge options will enable duplexing on the printer, if the printer supports it. The -o sides=two-sided-short-edge option is suitable for landscape pages, while the -o sides=two-sided-long-edge option is suitable for portrait pages:

Document Options

The following options apply when printing all types of files.

Selecting a Range of Pages

The -o page-ranges=pages option selects a range of pages for printing:

As shown above, the pages value can be a single page, a range of pages, or a collection of page numbers and ranges separated by commas. The pages will always be printed in ascending order, regardless of the order of the pages in the page-ranges option.

The default is to print all pages.

Selecting Even or Odd Pages

Use the -o page-set=set option to select the even or odd pages:

The default is to print all pages.

Setting the Output Order

The the -o outputorder=order option to set the output order of all pages:

N-Up Printing

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:

The -o page-border=value option chooses the border to draw around each page:

The -o number-up-layout=value option chooses the layout of the pages on each output page:

Mirroring Prints

You can mirror a print using the -o mirror option:

This is useful for printing mirrored pages on transfer paper, for T shirts, mugs, etc.

Setting the Brightness

You can control the overall brightness of the printed output using the -o brightness=percent option:

Values greater than 100 will lighten the print, while values less than 100 will darken it.

Setting the Gamma Correction

You can control the overall gamma correction of the printed output using the -o gamma=value option:

Values greater than 1000 will lighten the print, while values less than 1000 will darken it. The default gamma is 1000.

Text Options

The following options apply when printing text files.

Setting the Number of Characters Per Inch

The -o cpi=value option sets the number of characters per inch:

The default characters per inch is 10.

Setting the Number of Lines Per Inch

The -o lpi=value option sets the number of lines per inch:

The default lines per inch is 6.

Setting the Number of Columns

The -o columns=value option sets the number of text columns:

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:

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:

Image Options

The following options apply when printing image files.

Positioning the Image

The -o position=name option specifies the position of the image on the page:

Scaling the Image

The -o scaling=percent, -o ppi=value, and -o natural-scaling=percent options change the size of a printed image:

The scaling=percent value is a number from 1 to 800 specifying the size in relation to the page (not the image.) A scaling of 100 percent will fill the page as completely as the image aspect ratio allows. A scaling of 200 percent will print on up to 4 pages.

The ppi=value value is a number from 1 to 1200 specifying the resolution of the image in pixels per inch. An image that is 3000x2400 pixels will print 10x8 inches at 300 pixels per inch, for example. If the specified resolution makes the image larger than the page, multiple pages will be printed to satisfy the request.

The natural-scaling=percent value is a number from 1 to 800 specifying the size in relation to the natural image size. A scaling of 100 percent will print the image at its natural size, while a scaling of 50 percent will print the image at half its natural size. If the specified scaling makes the image larger than the page, multiple pages will be printed to satisfy the request.

Adjusting the Hue (Tint) of an Image

The -o hue=value option will adjust the hue of the printed image, much like the tint control on your television:

The value argument is a number from -360 to 360 and represents the color hue rotation. The following table summarizes the change you'll see with different colors:

Original hue=-45 hue=45
Red Purple Yellow-orange
Green Yellow-green Blue-green
Yellow Orange Green-yellow
Blue Sky-blue Purple
Magenta Indigo Crimson
Cyan Blue-green Light-navy-blue

The default hue adjustment is 0.

Adjusting the Saturation (Color) of an Image

The -o saturation=percent option adjusts the saturation of the colors in an image, much like the color knob on your television:

The percent argument specifies the color saturation from 0 to 200. A color saturation of 0 produces a black-and-white print, while a value of 200 will make the colors extremely intense.

The default saturation is 100.