# Preface

This software users manual describes how to use the Common UNIX Printing SystemTM ("CUPSTM") Version 1.1.19.

## Document Overview

This software users manual is organized into the following sections:

- 1 - Printing System Overview
- 2 - Using the Printing System
- 3 - Standard Printer Options
- 4 - Saving Printer Options and Defaults
- A - Software License Agreement

## Notation Conventions

Various font and syntax conventions are used in this guide. Examples and their meanings and uses are explained below:

Example |  | Description
`lpstat` `lpstat(1)` |  | The names of commands; the first mention of a command or function in a chapter is followed by a manual page section number.
/var /usr/share/cups/data/testprint.ps |  | File and directory names.
`Request ID is Printer-123` |  | Screen output.
`lp -d printer filename ENTER` |  | Literal user input; special keys like `ENTER` are in ALL CAPS.
12.3 |  | Numbers in the text are written using the period (.) to indicate the decimal point.

## Abbreviations

The following abbreviations are used throughout this manual:

kb
  Kilobytes, or 1024 bytes
Mb
  Megabytes, or 1048576 bytes
Gb
  Gigabytes, or 1073741824 bytes

## Other References

CUPS Software Administrators Manual
  An administration guide for the CUPS software.
CUPS Software Programmers Manual
  A programmer guide for interfacing with and/or extending the CUPS software.

# 2 - 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:

    lp filename ENTER

or:

    lpr filename ENTER

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:

    lpstat -p -d ENTER

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 `-d` option with the `lp` command to print to a specific printer:

    lp -d printer filename ENTER

or the `-P` option with the `lpr` command:

    lpr -P printer filename ENTER

## 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 `lp` and `lpr` commands allow you to pass printer options using the `-o` option:

    lp -o landscape -o scaling=75 -o media=A4 filename.jpg
    lpr -o landscape -o scaling=75 -o media=A4 filename.jpg

The available printer options vary depending on the printer. The standard options are described in Chapter 3, "Standard Printing Options".

## Printing Multiple Copies

Both the `lp` and `lpr` commands have options for printing more than one copy of a file:

    lp -n num-copies filename ENTER
    lpr -#num-copies filename ENTER

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

    lp -n num-copies -o Collate=True filename ENTER
    lpr -#num-copies -o Collate=True filename ENTER

## Checking the Printer Status from the Command-Line

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

    lpstat ENTER
    Printer-1 johndoe 4427776
    Printer-2 johndoe 15786
    Printer-3 johndoe 372842

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

    lpstat -p ENTER
    printer DeskJet now printing DeskJet-1.

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

    lpstat -o -p ENTER
    Printer-1 johndoe 4427776
    Printer-2 johndoe 15786
    Printer-3 johndoe 372842
    printer DeskJet now printing DeskJet-1.

## 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:

    http://localhost:631

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:

    cancel job-id ENTER
    lprm job-id ENTER

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

# 3 - 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:

    lp -o media=Letter filename ENTER
    lp -o media=Letter,MultiPurpose filename ENTER
    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.5x11 inches, or 216x279mm)
- `Legal` - US Legal (8.5x14 inches, or 216x356mm)
- `A4` - ISO A4 (8.27x11.69 inches, or 210x297mm)
- `COM10` - US #10 Envelope (9.5x4.125 inches, or 241x105mm)
- `DL` - ISO DL Envelope (8.66x4.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.

### Setting the Orientation

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

    lp -o landscape filename ENTER
    lpr -o landscape filename ENTER

### 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:

    lp -o sides=two-sided-short-edge filename ENTER
    lp -o sides=two-sided-long-edge filename ENTER
    lpr -o sides=two-sided-long-edge filename ENTER

The default is to print single-sided:

    lp -o sides=one-sided filename ENTER
    lpr -o sides=one-sided filename ENTER

## Banner Options

The following options apply when printing all types of files.

### Selecting the Banner Page(s)

The `-o jobsheets=start,end` option sets the banner page(s) to use for a job:

    lp -o job-sheets=none filename ENTER
    lp -o job-sheets=standard filename ENTER
    lpr -o job-sheets=classified,classified filename ENTER

If only one banner file is specified, it will be printed before the files in the job. If a second banner file is specified, it is printed after the files in the job.

The available banner pages depend on the local system configuration; CUPS includes the following banner files:

- `none` - Do not produce a banner page.
- `classified` - A banner page with a "classified" label at the top and bottom.
- `confidential` - A banner page with a "confidential" label at the top and bottom.
- `secret` - A banner page with a "secret" label at the top and bottom.
- `standard` - A banner page with no label at the top and bottom.
- `topsecret` - A banner page with a "top secret" label at the top and bottom.
- `unclassified` - A banner page with an "unclassified" label at the top and bottom.

## 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:

    lp -o page-ranges=1 filename ENTER
    lp -o page-ranges=1-4 filename ENTER
    lp -o page-ranges=1-4,7,9-12 filename ENTER
    lpr -o page-ranges=1-4,7,9-12 filename ENTER

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:

    lp -o page-set=odd filename ENTER
    lp -o page-set=even filename ENTER
    lpr -o page-set=even filename ENTER

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:

    lp -o outputorder=normal filename ENTER
    lp -o outputorder=reverse filename ENTER
    lpr -o outputorder=reverse filename ENTER

### 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:

    lp -o number-up=1 filename ENTER
    lp -o number-up=2 filename ENTER
    lp -o number-up=4 filename ENTER
    lpr -o number-up=16 filename ENTER

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

- `-o page-border=double`; draw two hairline borders around each page
- `-o page-border=double-thick`; draw two 1pt borders around each page
- `-o page-border=none`; do not draw a border (default)
- `-o page-border=single`; draw one hairline border around each page
- `-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:

- `-o number-up-layout=btlr`; Bottom to top, left to right
- `-o number-up-layout=btrl`; Bottom to top, right to left
- `-o number-up-layout=lrbt`; Left to right, bottom to top
- `-o number-up-layout=lrtb`; Left to right, top to bottom (default)
- `-o number-up-layout=rlbt`; Right to left, bottom to top
- `-o number-up-layout=rltb`; Right to left, top to bottom
- `-o number-up-layout=tblr`; Top to bottom, left to right
- `-o number-up-layout=tbrl`; Top to bottom, right to left

### Mirroring Prints

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

    lp -o mirror filename ENTER
    lpr -o mirror filename ENTER

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:

    lp -o brightness=120 filename ENTER
    lpr -o brightness=120 filename ENTER

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:

    lp -o gamma=1700 filename ENTER
    lpr -o gamma=1700 filename ENTER

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:

    lp -o cpi=10 filename ENTER
    lp -o cpi=12 filename ENTER
    lpr -o cpi=17 filename ENTER

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:

    lp -o lpi=6 filename ENTER
    lpr -o lpi=8 filename ENTER

The default lines per inch is 6.

### Setting the Number of Columns

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

    lp -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:

    lp -o page-left=value filename ENTER
    lp -o page-right=value filename ENTER
    lp -o page-top=value filename ENTER
    lp -o page-bottom=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:

    lp -o prettyprint filename ENTER
    lpr -o prettyprint filename ENTER

## 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:

- `center` - Center the image on the page (default)
- `top` - Print the image centered at the top of the page
- `left` - Print the image centered on the left of page
- `right` - Print the image centered on the right of the page
- `top-left` - Print the image at the top left corner of the page
- `top-right` - Print the image at the top right corner of the page
- `bottom` - Print the image centered at the bottom of the page
- `bottom-left` - Print the image at the bottom left corner of the page
- `bottom-right` - Print the image at the bottom right corner of 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:

    lp -o scaling=percent filename ENTER
    lp -o ppi=value filename ENTER
    lpr -o natural-scaling=percent filename ENTER

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:

    lp -o hue=value filename ENTER
    lpr -o hue=value filename ENTER

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:

    lp -o saturation=percent filename ENTER
    lpr -o saturation=percent filename ENTER

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.

## HP-GL/2 Options

The following options apply to HP-GL/2 files.

### Printing in Black

The `-o blackplot` option specifies that all pens should plot in black:

    lp -o blackplot filename ENTER
    lpr -o blackplot filename ENTER

The default is to use the colors defined in the plot file or the standard pen colors defined in the HP-GL/2 reference manual from Hewlett Packard.

### Fitting the Plot on the Page

The `-o fitplot` option specifies that the plot should be scaled to fit on the page:

    lp -o fitplot filename ENTER
    lpr -o fitplot filename ENTER

The default is to use the absolute distances specified in the plot file.

NOTE: This feature depends upon an accurate plot size (`PS`) command in the HP-GL/2 file. If no plot size is given in the file than the HP-GL/2 filter assumes the plot is ANSI E size.

### Setting the Default Pen Width

The `-o penwidth=value` option specifies the default pen width for HP-GL/2 files:

    lp -o penwidth=value filename ENTER
    lpr -o penwidth=value filename ENTER

The pen width `value` specifies the pen width in micrometers. The default value of 1000 produces lines that are 1 millimeter in width. Specifying a pen width of 0 produces lines that are exactly 1 pixel wide.

NOTE: This option is ignored when the pen widths are set in the plot file.

## Raw or Unfiltered Output

The `-o raw` option allows you to send files directly to a printer without filtering. This is sometimes required when printing from applications that provide their own "printer drivers" for your printer:

    lp -o raw filename ENTER
    lpr -o raw filename ENTER

The `-l` option can also be used with the `lpr` command to send files directly to a printer:

    lpr -l filename ENTER

# 4 - Saving Printer Options and Defaults

This chapter describes how to save printer options for your printer and set your own default printer.

## Printer Options

Each printer supports a large number of options, which you learned about in Chapter 3, "Standard Printer Options". Rather than specifying these options each time you print a file, CUPS allows you to save them as "default" options for the printer.

The `lpoptions(1)` command saves the options for your printers. Like the `lp` and `lpr` commands, it accepts printer options using the `-o` argument:

    lpoptions -o prettyprint ENTER
    lpoptions -o media=A4 -o sides=two-sided-long-edge ENTER
    lpoptions -o media=Legal -o scaling=100 ENTER

Once saved, any `lp` or `lpr` command will use them when you print.

Note: Running the `lpoptions` command as the root user (or any user with a UID of 0) will set the default options for all users. The root account does not have its own set of default options.

## Setting Options for a Specific Printer

The previous example shows how to set the options for the default printer. The `-p printer` option specifies the options are for another printer:

    lpoptions -p laserjet -o prettyprint ENTER
    lpoptions -p laserjet -o media=A4 -o sides=two-sided-long-edge ENTER
    lpoptions -p deskjet -o media=Legal -o scaling=100 ENTER

## Removing Options

The previous two examples shows how to set options for the default and a specific printer. Below, shows you how to remove the saved option using the `-r` argument:

    lpoptions -r prettyprint ENTER
    lpoptions -p laserjet -r prettyprint ENTER

## Viewing the Current Defaults

The `lpoptions` command can also be used to show the current options by not specifying any new options on the command-line:

    lpoptions ENTER
    media=A4 sides=two-sided-long-edge
    lpoptions -p deskjet ENTER
    media=Legal scaling=100

## Viewing Options for a Specific Printer

You can display the supported options using the `lpoptions` command with the `-l` option, as follows:

    lpoptions -p laserjet -l ENTER

## Setting the Default Printer

The administrator normally will set a system-wide default printer that is normally used as the default printer by everyone. Use the `-d printer` option to set your own default printer:

    lpoptions -d deskjet ENTER

The printer can be local (`deskjet`) or remote (`deskjet@server`).

## Printer Instances

Besides setting options for each print queue, CUPS supports printer instances which allow you to define several different sets of options for each printer. You specify a printer instance using the slash (`/`) character:

    lpoptions -p laserjet/duplex -o sides=two-sided-long-edge ENTER
    lpoptions -p laserjet/legal -o media=Legal ENTER

The `lp` and `lpr` commands also understand this notation:

    lp -d laserjet/duplex filename ENTER
    lpr -P laserjet/legal filename ENTER

## Removing Instances

Use the `-x printer/instance` option to remove a printer instance that you no longer need:

    lpoptions -x laserjet ENTER
    lpoptions -x laserjet/duplex ENTER
    lpoptions -x laserjet/legal ENTER

The `-x` option only removes the default options for that printer and instance; the original print queue will remain until deleted with the `lpadmin(8)` command by the administrator.

# A - Software License Agreement