Voir aussi :
Source : http://localhost:631/help/options.html ou https://www.cups.org/doc/options.html
Printing Files
CUPS understands many different types of files directly, including text, PostScript, PDF, and image files. 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 file 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 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
or the -P option with the lpr command:
lpr -P printer filename
Setting the Default Printer
If you normally use a particular printer, you can tell CUPS to use it by default using the lpoptions(1) command:
lpoptions -d printer
Printing the Output of a Program
Both the lp and lpr commands support printing from the standard input:
program | lp program | lp -d printer program | lpr program | lpr -P printer
If the program does not provide any output, then nothing will be queued for printing. Specifying 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 fit-to-page -o media=A4 filename.jpg lpr -o landscape -o fit-to-page -o media=A4 filename.jpg
The available printer options vary depending on the printer. The standard options are described in the “Standard Printing Options” section below. Printer-specific options are also available and can be listed using the lpoptions command:
lpoptions -p printer -l
Creating Saved Options
Saved options are supported in CUPS through printer instances. Printer instances are, as their name implies, copies of a printer that have certain options associated with them. Use the lpoptions command to create a printer instance:
lpoptions -p printer/instance -o name=value ...
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
Instances do not inherit lpoptions from the main queue. 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 lpr -#num-copies filename
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
Canceling a Print Job
The cancel(1) and lprm(1) commands cancel a print job:
cancel job-id lprm job-id
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
Moving a Print Job
The lpmove(8) command moves a print job to a new printer or class:
lpmove job-id destination
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
Standard Printing 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 lp -o media=Letter,MultiPurpose filename lpr -o media=Letter,Transparency filename lpr -o media=Letter,MultiPurpose,Transparency filename
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. 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 -o media=Custom.WIDTHxLENGTH filename lp -o media=Custom.WIDTHxLENGTHin filename lp -o media=Custom.WIDTHxLENGTHcm filename lp -o media=Custom.WIDTHxLENGTHmm filename
where “WIDTH” and “LENGTH” are the width and length of the media in points, inches, centimeters, or millimeters, respectively. Setting the Orientation
The -o landscape option will rotate the page 90 degrees to print in landscape orientation:
lp -o landscape filename lpr -o landscape filename
The -o orientation-requested=N option rotates the page depending on the value of N:
Printing On Both Sides of the Paper
The -o sides=two-sided-short-edge and -o sides=two-sided-long-edge options will enable two-sided printing 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 lp -o sides=two-sided-long-edge filename lpr -o sides=two-sided-long-edge filename
The default is to print single-sided:
lp -o sides=one-sided filename lpr -o sides=one-sided filename
Selecting the Banner Page(s)
The -o job-sheets=start,end option sets the banner page(s) to use for a job:
lp -o job-sheets=none filename lp -o job-sheets=standard filename lpr -o job-sheets=classified,classified filename
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.
Holding Jobs for Later Printing
The -o job-hold-until=when option tells CUPS to delay printing until the “when” time, which can be one of the following:
Releasing Held Jobs
Aside from the web interface, you can use the lp command to release a held job:
lp -i job-id -H resume
where “job-id” is the job ID reported by the lpstat command. Setting the Job Priority
The -o job-priority=NNN option tells CUPS to assign a priority to your job from 1 (lowest) to 100 (highest), which influences where the job appears in the print queue. Higher priority jobs are printed before lower priority jobs, however submitting a new job with a high priority will not interrupt an already printing job. Specifying the Output Order
The -o outputorder=normal and -o outputorder=reverse options specify the order of the pages. Normal order prints page 1 first, page 2 second, and so forth. Reverse order prints page 1 last. Selecting a Range of Pages
The -o page-ranges=pages option selects a range of pages for printing:
lp -o page-ranges=1 filename lp -o page-ranges=1-4 filename lp -o page-ranges=1-4,7,9-12 filename lpr -o page-ranges=1-4,7,9-12 filename
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
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:
The -o number-up-layout=value option chooses the layout of the pages on each output page:
Scaling to Fit
The -o fit-to-page option specifies that the document should be scaled to fit on the page:
lp -o fit-to-page filename lpr -o fit-to-page filename
The default is to use the size specified in the file.
Note:
This feature depends upon an accurate size in the print file. If no size is given in the file, the page may be scaled incorrectly!
Printing in Reverse Order
The -o outputorder=reverse option will print the pages in reverse order:
lp -o outputorder=reverse filename lpr -o outputorder=reverse filename
Similarly, the -o outputorder=normal option will print starting with page 1:
lp -o outputorder=normal filename lpr -o outputorder=normal filename
The default is -o outputorder=normal for printers that print face down and -o outputorder=reverse for printers that print face up. Printing Mirrored Pages
The -o mirror option flips each page along the vertical axis to produce a mirrored image:
lp -o mirror filename lpr -o mirror filename
This is typically used when printing on T-shirt transfer media or sometimes on transparencies
Source : http://localhost:631/help/admin.html ou https://www.cups.org/doc/admin.html
This help document describes how to configure and manage destinations with CUPS. Introduction
Destinations are individual printers and classes (pools) of printers. Printers use a description file with one or more driver (“filter”) programs that communicate with the printer through a “backend” program. CUPS currently uses PPD (PostScript Printer Description) files to describe the printer and driver programs needed, some of which come with CUPS while others come with your operating system or Linux distribution. Backends are specified using a URI (Universal Resource Identifier) where the URI scheme is the backend name, e.g., “ipp:11.22.33.44/ipp/print” specifies the “ipp” backend - like PPD files, some backends come with CUPS while others come with your operating system.
Classes are associated with one or more printers and are typically used to distribute print jobs amongst a group of printers or provide redundancy or high availability when printing. Print jobs sent to a class are forwarded to the next available printer in the class.
The lpadmin(8) program is used to add, modify, or delete destinations, while the lpinfo(8) command is used to list the available printer drivers and backends. The cupsctl(8) program is used to manage the printing system as a whole, including things like debug logging and printer sharing. The CUPS web interface (“http://localhost:631” or “https://servername:631”) can also be used, and most operating systems provide their own GUI administration tools. Managing Printers
The lpadmin command is used to create, modify, or delete a printer. The -p option specifies a printer to create or modify:
lpadmin -p printername …
The lpadmin accepts several additional options after -p printername when adding or modifying a printer:
-D “description”
Sets the description of the printer which is often shown instead of the printer name, for example "HP LaserJet".
-E
Enables the printer and accepts new print jobs.
-L “location”
Sets the location of the printer, for example "Conference Room".
-m model
Sets the printer driver using the model name.
-o option=value
Sets the named option.
-v device-uri
Sets the URI for the printer.
The -x option deletes the named printer:
lpadmin -x printername
Printer Drivers and PPDs
The -m option to lpadmin specifies the driver (“model”) to use for the printer. You can run the lpinfo -m command to list all of the available drivers (“models”) on your system:
lpinfo -m
Each line contains the driver name followed by its description, for example:
drv:/sample.drv/dymo.ppd Dymo Label Printer drv:/sample.drv/epson9.ppd Epson 9-Pin Series drv:/sample.drv/epson24.ppd Epson 24-Pin Series drv:/sample.drv/generpcl.ppd Generic PCL Laser Printer drv:/sample.drv/generic.ppd Generic PostScript Printer drv:/sample.drv/deskjet.ppd HP DeskJet Series drv:/sample.drv/laserjet.ppd HP LaserJet Series PCL 4/5 drv:/sample.drv/intelbar.ppd Intellitech IntelliBar Label Printer, 2.1 drv:/sample.drv/okidata9.ppd Oki 9-Pin Series drv:/sample.drv/okidat24.ppd Oki 24-Pin Series drv:/sample.drv/zebracpl.ppd Zebra CPCL Label Printer drv:/sample.drv/zebraep1.ppd Zebra EPL1 Label Printer drv:/sample.drv/zebraep2.ppd Zebra EPL2 Label Printer drv:/sample.drv/zebra.ppd Zebra ZPL Label Printer everywhere IPP Everywhere
The everywhere driver is used for nearly all modern networks printers sold since about 2009. For example, the following command creates a destination for a printer at IP address 11.22.33.44:
lpadmin -p printername -E -v ipp:11.22.33.44/ipp/print -m everywhere
The CUPS sample drivers (the “drv:/sample.drv/…” lines above) can be used for “legacy” printers. For example, the following command creates a destination for a HP LaserJet printer at IP address 11.22.33.44:
lpadmin -p printername -E -v socket:11.22.33.44 -m drv:/sample.drv/laserjet.ppd
Note: The CUPS sample drivers are designed to provide basic printing capabilities for the broadest range of printers possible, but generally do not exercise the full potential of the printers or CUPS. Other drivers (including the everywhere driver) provide greater printing capabilities and better print quality.
Device URIs (Backends)
CUPS comes with several standard backends that communicate with printers:
dnssd: The Bonjour (DNS-SD) protocol. ipp: The Internet Printing Protocol (IPP) with optional encryption. ipps: The Internet Printing Protocol with mandatory encryption. lpd: The Line Printer Daemon protocol. socket: The AppSocket (JetDirect) protocol. usb: The Universal Serial Bus (USB) printer class.
Run the lpinfo -v command to list the available backends and printers:
lpinfo -v
Each line contains the backend “class” followed by the backend name or a full printer device URI, for example:
network lpd network ipps network ipp network socket network dnssd:Acme%20Laser%20Pro._ipp._tcp.local./?uuid=545253fb-1cb7-4d8d-98ed-ab6cd607cea7 network dnssd:Bar99._printer.tcp.local./?uuid=f9efff58-9086-4c95-accb-81dee876a475 network dnssd:Example%20EX-42._ipps._tcp.local./?uuid=4a0c67ad-2824-4ddf-9115-7d4226c5fe65 network dnssd:Foo%20Fighter-1969._pdl-datastream._tcp.local./?uuid=4e216bea-c3de-4f65-a710-c99e11c80d2b direct usb:ZP/LazerJet%20MFP?serial=42
The network class of backends is used for all network protocols. The Using Network Printers help document describes how to use the standard CUPS network backends. The direct class of backends is used for directly-connected printers such as USB and Bluetooth. Because these backends use a system-specific identifier, you should only use the reported device URIs.
Once you know the correct URI for the printer, set it using the lpadmin command's -v option:
lpadmin -p printername -v device-uri
Printer Options
The lpadmin command allows you to set various options for a printer:
-o cupsIPPSupplies=false
Turns off IPP supply level reporting for a printer.
-o cupsSNMPSupplies=false
Turns off SNMP supply level reporting for a printer.
-o name=value
Sets the default value for the named PPD option. For example, -o PageSize=Legal sets the default page size to US Legal.
-o printer-error-policy=name
Sets the policy for errors such as printers that cannot be found or accessed, don't support the format being printed, fail during submission of the print data, or cause one or more filters to crash:
abort-job
Aborts the job on error.
retry-job
Retries the job at a future time.
retry-current-job
Retries the current job immediately.
stop-printer
Stops the printer on error.
-o printer-is-shared=true/false
Enables/disables per-printer sharing. See the section on Printer Sharing for more information.
-o printer-op-policy=name
Sets the operation policy associated with the printer. See the Managing Operation Policies help document for more information.
-u allow:{user|@group}{,user|,@group}* -u allow:all -u deny:{user|@group}{,user|,@group}* -u deny:none
Sets user-level access control for the printer. The allow: list defines a whitelist of users and groups while the deny: list defines a blacklist of users and groups.
Printer Sharing
CUPS supports sharing of printers with other computers and mobile devices. Two cupsctl options control the general printer sharing features:
--share-printers
Enables sharing of printers with other computers and mobile devices on your local network.
--remote-any
Expands printer sharing to any network that can reach your server.
Once you have enabled printer sharing, you then must select which printers will be shared using the lpadmin command and the -o printer-is-shared=true option.
For example, to share two printers (“foo” and “bar”) on the local network, run the following commands:
cupsctl --share-printers lpadmin -p foo -o printer-is-shared=true lpadmin -p bar -o printer-is-shared=true
Managing Classes
The lpadmin command is used to create, modify, or delete a class. The -c option specifies a class to create or modify and is combined with the -p option:
lpadmin -p printername -c classname
The -r option specifies that the named printer is removed from the class:
lpadmin -p printername -r classname
The -x option deletes the named class:
lpadmin -x classname
Debug Logging and Troubleshooting
The printing system log files track the activity of the scheduler, printer drivers, and backends. If problems occur and the log files do not provide sufficient details to diagnose the problem, you can enable debug logging using the cupsctl command:
cupsctl --debug-logging
To disable debug logging, run the same command with the --no-debug-logging option:
cupsctl --no-debug-logging