Command-Line Printing and Options - Documentation - CUPS
Command-Line Printing and Options - Documentation - CUPS
http://www.cups.org/documentation.php/options.html
Login
Articles Book
Documentation
CUPS 1.2 CUPS 1.3
Download
CUPS 1.4
Drivers
CUPS 1.5
Forums
Other CUPS
Links
Search Help
Search
Printing Files
CUPS understands many di erent types of les directly, including text, PostScript, PDF, and image les. This allows you to print from inside your applications or at the command-line, whichever is most convenient! Type either of the following commands to print a le to the default (or only) printer on the system:
lp filename lpr filename
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
The -p option species 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 specic printer:
lp -d printer filename
If the program does not provide any output, then nothing will be queued for printing.
The available printer options vary depending on the printer. The standard options are described in the "Standard Printing Options" section below. Printer-specic options are also available and can be listed using the lpoptions command:
1 of 7
9/28/11 11:24 AM
http://www.cups.org/documentation.php/options.html
lpoptions -p printer -l
The -p printer/instance option provides the name of the instance, which is always the printer name, a slash, and the instance name which can contain any printable characters except space and slash. The remaining options are then associated with the instance instead of the main queue. For example, the following command creates a duplex instance of the LaserJet queue:
lpoptions -p LaserJet/duplex -o sides=two-sided-long-edge
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 lpr -#num-copies -o Collate=True filename
The job-id is the number that was reported to you by the lp command. You can also get the job ID using the lpq(1) or lpstat commands:
lpq lpstat
The job-id is the number that was reported to you by the lp or lpstat commands. Destination is the name of a printer or class that you want to actually print the job. Note: The lpmove command is located in the system command directory (typically /usr/sbin or /usr/local/sbin), and so may not be in your command path. Specify the full path to the command if you get a "command not found" error, for example:
/usr/sbin/lpmove foo-123 bar
2 of 7
9/28/11 11:24 AM
http://www.cups.org/documentation.php/options.html
The available media sizes, types, and sources depend on the printer, but most support the following options (case is not signicant):
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 dened in the printer's PPD le in the PageSize, InputSlot, and MediaType options. You can list them using the lpoptions(1) command:
lpoptions -p printer -l
When Custom is listed for the PageSize option, you can specify custom media sizes using one of the following forms:
lp lp lp lp -o -o -o -o media=Custom.WIDTHxLENGTH filename media=Custom.WIDTHxLENGTHin filename media=Custom.WIDTHxLENGTHcm filename media=Custom.WIDTHxLENGTHmm filename
where "WIDTH" and "LENGTH" are the width and length of the media in points, inches, centimeters, or millimeters, respectively.
portrait orientation (no rotation) landscape orientation (90 degrees) reverse landscape or seascape orientation (270 degrees) reverse portrait or upside-down orientation (180 degrees)
If only one banner le is specied, it will be printed before the les in the job. If a second banner le is specied, it is printed after the les in the job. The available banner pages depend on the local system conguration; CUPS includes the following banner les:
3 of 7
9/28/11 11:24 AM
http://www.cups.org/documentation.php/options.html
none - Do not produce a banner page. classified - A banner page with a "classied" label at the top and bottom. confidential - A banner page with a "condential" 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 "unclassied" label at the top and bottom.
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. Note: The page numbers used by page-ranges refer to the output pages and not the document's page numbers. Options like number-up can make the output page numbering not match the document page numbers.
N-Up Printing
4 of 7
9/28/11 11:24 AM
http://www.cups.org/documentation.php/options.html
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 lp -o number-up=2 filename lp -o number-up=4 filename lpr -o number-up=16 filename
The -o page-border=value option chooses the border to draw around each page:
-o -o -o -o -o page-border=double; draw two hairline borders around each page page-border=double-thick; draw two 1pt borders around each page page-border=none; do not draw a border (default) page-border=single; draw one hairline border around each page 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 -o -o -o -o -o -o -o number-up-layout=btlr; number-up-layout=btrl; number-up-layout=lrbt; number-up-layout=lrtb; number-up-layout=rlbt; number-up-layout=rltb; number-up-layout=tblr; number-up-layout=tbrl;
Bottom to top, left to right Bottom to top, right to left Left to right, bottom to top Left to right, top to bottom (default) Right to left, bottom to top Right to left, top to bottom Top to bottom, left to right Top to bottom, right to left
Scaling to Fit
The -o fit-to-page option species that the document should be scaled to t on the page:
lp -o fit-to-page filename lpr -o fit-to-page filename
The default is to use the size specied in the le. Note: This feature depends upon an accurate size in the print le. If no size is given in the le, the page may be scaled incorrectly!
The default is -o outputorder=normal for printers that print face down and -o outputorder=reverse for printers that print face up.
This is typically used when printing on T-shirt transfer media or sometimes on transparencies.
5 of 7
9/28/11 11:24 AM
http://www.cups.org/documentation.php/options.html
The -l option can also be used with the lpr command to send les directly to a printer:
lpr -l filename
Text Options
CUPS supports several options that are only used when printing plain text les. These options have absolutely no e ect on PostScript, PDF, HP-GL/2, or image les.
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 lename), and the date. Also, C and C++ keywords are highlighted, and comment lines are italicized:
lp -o prettyprint filename lpr -o prettyprint filename
Turning O
Text Wrapping
Image Options
CUPS supports several options that are only used when printing image les. These options have absolutely no e ect on PostScript, PDF, HP-GL/2, or text les.
Positioning Images
The -o position=name option species the position of the image on the page:
6 of 7
9/28/11 11:24 AM
http://www.cups.org/documentation.php/options.html
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 Images
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 lp -o ppi=value filename lpr -o natural-scaling=percent filename
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 ll 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 specied 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 specied scaling makes the image larger than the page, multiple pages will be printed to satisfy the request.
HP-GL/2 Options
CUPS supports several options that are only used when printing HP-GL/2 les. These options have absolutely no e ect on PostScript, PDF, image, or text les.
Printing in Black
The -o blackplot option species that all pens should plot in black:
lp -o blackplot filename lpr -o blackplot filename
The default is to use the colors dened in the plot le or the standard pen colors dened in the HP-GL/2 reference manual from Hewlett Packard.
The pen width value species 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 le.
Comments are owned by the poster. All other material is copyright 2007-2011 Apple Inc. All rights reserved. CUPS and the CUPS logo are trademarks of Apple Inc. All other trademarks are the property of their respective owners. Please report site problems to '[email protected]'.
7 of 7
9/28/11 11:24 AM