User:Pypi/CUPS
CUPS is the standards-based, open source printing system developed by Apple Inc. for OS X® and other UNIX®-like operating systems.
Installation
If you intend to "print" into a PDF document, also install the cups-pdf package. By default, pdf files are stored in /var/spool/cups-pdf/$USER
. The location can be changed in /etc/cups/cups-pdf.conf
.
Start and enable org.cups.cupsd.service
.
Connection Interfaces
Additional steps for printer detection are listed below for various connection interfaces.
lp
group and daemon
user. This allows the helper programs to access printer devices and read config files in /etc/cups/
, which all belong to the lp
group. This default may conflict with non-printer parallel port device access:
- Adding extra users to the
lp
group will allow those users to read CUPS files, and - CUPS helpers may gain access to any non-printer parallel port devices.
USB
To see if your USB printer is detected:
lsusb
(...) Bus 001 Device 007: ID 03f0:1004 Hewlett-Packard DeskJet 970c/970cse
Parallel port
To use a parallel port printer, the lp
, parport
and parport_pc
kernel modules are required.
dmesg | grep -i parport
parport0: Printer, Hewlett-Packard HP LaserJet 2100 Series lp0: using parport0 (polling)
Network
To use Avahi hostnames to connect to networked printers, set up .local hostname resolution and restart org.cups.cupsd.service
.
If the system is connected to a networked printer using the Samba protocol, or if the system is to be a print server for Windows clients, install the samba package.
Printer Drivers
The drivers for a printer may come from any of the sources shown below. See CUPS/Printer-specific problems for an incomplete list of drivers that others have managed to get working.
To drive a printer, CUPS needs a PPD file and, for most printers, some filters. For details on how CUPS uses PPDs and filters, see [1].
The OpenPrinting Printer List provides driver recommendations for many printers. It also supplies PPD files for each printer, but most are available through foomatic or the recommended driver package.
Even when a PPD file is provided to CUPS, the CUPS server will regenerate the PPD files and save them in /etc/cups/ppd/
.
CUPS
CUPS provides a few PPDs and filter binaries by default, which should work out of the box.
Foomatic
The foomatic project provides PPDs for many printer drivers, both free and nonfree. For more information about what foomatic does, see Foomatic from the Developer's View.
To use foomatic, install foomatic-db-engine, and at least one of foomatic-db-ppds, foomatic-db-nonfree-ppds, or foomatic-db-gutenprint-ppds.
The foomatic PPDs may require additional filters, such as gutenprint, ghostscript, or another source (for instance min12xxwAUR). For ghostscript, gsfonts may also be required.
Manufacturer-specific drivers
Many printer manufacturers supply their own Linux drivers. These are often available in the official Arch repositories or in the AUR.
Some of those drivers are described in more detail in CUPS/Printer-specific problems.
Printer URI
Listed below are additional steps to manually generate the URI if required.
USB
CUPS should be able to automatically generate a URI for USB printers, for example usb://HP/DESKJET%20940C?serial=CN16E6C364BH
.
If it doesn't, see CUPS/Troubleshooting#USB printers for troubleshooting steps.
Parallel port
The URI should be of the form parallel:device
. For instance, if the printer is connected on /dev/lp0
, use parallel:/dev/lp0
.
If you are using a USB to parallel port adapter, use parallel:/dev/usb/lp0
as the printer URI.
Network
If you have set up Avahi as in #Network, CUPS should detect the printer URI. You can also use avahi-discover
to find the name of your printer and its address (for instance, BRN30055C6B4C7A.local/10.10.0.155:631
).
The URI can also be generated manually, without using Avahi. A list of the available URI schemes for networked printers is available in the CUPS documentation [2]. As exact details of the URIs differ between printers, check either the manual of the printer or CUPS/Printer-specific problems.
Remote CUPS print servers can be accessed through a URI of the form ipp://hostname:631/printers/queue_name
. See CUPS/Printer sharing#Between GNU/Linux systems for details on setting up the remote print server.
See CUPS/Troubleshooting#Networking issues for additional issues and solutions.
Usage
CUPS can be fully controlled using the lp* and cups* command-line tools. Alternatively, the web interface or one of several GUI applications can be used.
- The queue name is a short but descriptive name used on the system to identify the queue. This name should not contain spaces or any special characters. For instance, a print queue corresponding to a HP LaserJet 5P could be named "hpljet5p". More than one queue can be associated with each physical printer.
- The location is a description of the printer's physical location (for instance "bedroom", or "kitchen"). This is to aid in maintaining several printers.
- The description is a full description of the printer. A common use is the full printer name (like "HP LaserJet 5P").
CLI tools
See CUPS local documentation for more tips on the command-line tools.
- List the devices
# lpinfo -v # $ /usr/lib/cups/backend/snmp ip_address # Use SNMP to find a URI
- List the drivers
$ lpinfo -m
- Add a new queue
# lpadmin -p queue_name -E -v uri -m model
The queue_name is up to you. Example:
# lpadmin -p HP_DESKJET_940C -E -v "usb://HP/DESKJET%20940C?serial=CN16E6C364BH" -m drv:///HP/hp-deskjet_940c.ppd.gz # lpadmin -p SHARED_PRINTER -m raw # Raw queue; no PPD or filter
- Set the default printer
$ lpoptions -d queue_name
- Change the options
$ lpoptions -p queue_name -l # List the options $ lpoptions -p queue_name -o option=value # Set an option
Example:
$ lpoptions -p HP_DESKJET_940C -o PageSize=A4
- Check the status
$ lpstat -s $ lpstat -p queue_name
- Deactivate a printer
# cupsdisable queue_name
- Activate a printer
# cupsenable queue_name
- Set the printer to accept jobs
# cupsaccept queue_name
- Remove a printer
First set it to reject all incoming entries:
# cupsreject queue_name
Then disable it.
# cupsdisable queue_name
Finally remove it.
# lpadmin -x queue_name
- Print a file
$ lpr file $ lpr -# 17 file # print the file 17 times $ echo "Hello, world!" | lpr -p # print the result of a command. The -p switch adds a header.
- Check the queue
$ lpq $ lpq -a # on all queues
- Clear the queue
# lprm # remove last entry only # lprm - # remove all entries
Web interface
The CUPS server can be fully administered through the web interface, available on http://localhost:631/.
- Add a queue
Go to the Administration page.
- Modify existing queues
Go to the Printers page, and select a queue to modify.
- Test a queue
Go to the Printers page, and select a queue.
GUI applications
If your user does not have sufficient privileges to administer CUPS, the applications will request the root password when they start. To give users administrative privileges without needing root access, see #Configuration.
- print-manager — A tool for managing print jobs and printers (KDE).
- system-config-printer — A CUPS printer configuration tool and status applet (GNOME and others)
- gtklp — GTK+ interface to CUPS.
Configuration
The CUPS server configuration is located in /etc/cups/cupsd.conf
and /etc/cups/cups-files.conf
. After editing either file, restart org.cups.cupsd.service
to apply any changes. The default configuration is sufficient for most users.
User groups with printer administration privileges are defined in SystemGroup
in the /etc/cups/cups-files.conf
. The sys
group is used by default.
cups is built with libpaper support and libpaper defaults to the Letter paper size. To avoid having to change the paper size for each print queue you add, edit /etc/papersize
and set your system default paper size. See papersize(5).
By default, all logs are sent to files in /var/log/cups/
. By changing the values of the AccessLog
, ErrorLog
, and PageLog
directives in /etc/cups/cups-files.conf
to syslog
, CUPS can be made to log to the systemd journal instead. See the fedora wiki page for information on the original proposed change.
cups-browsed
CUPS can use Avahi browsing to discover unknown shared printers in your network. This can be useful in large setups where the server is unknown. To use this feature, set up .local hostname resolution, and start both avahi-daemon.service
and cups-browsed.service
. Note that jobs are sent directly to the printer without any processing so the created queues may not work.
Printer sharing
See CUPS/Printer sharing.
Without a local CUPS server
CUPS can be configured to directly connect to remote printer servers instead of running a local print server.
Install libcups. To print from some applications, you will also need to install cups.
There are two methods for accessing a remote print server.
The first method involves setting CUPS_SERVER
for each application, for instance for Firefox:
# (Substitute printserver.mydomain with your print server name) CUPS_SERVER=printserver.mydomain:port firefox
The second method involves editing /etc/cups/client.conf
and setting the ServerName
directive:
/etc/cups/client.conf
is deprecated/etc/cups/client.conf
# (Substitute printserver.mydomain with your print server name) ServerName printserver.mydomain
The remote system's default printer setting will be used by default.
Troubleshooting
See CUPS/Troubleshooting.