A basic view of the CUPS Printing system.
- Software Installation
- Driverless Printing
- Adding a Printer
- Printer Status and Control
- Print to a PDF
- Alternative Configuration Methods and Utilities
- CUPS as Print Server for Windows Machines
- CUPS and Samba
- Printer Sharing Using Macintosh as the Client and Debian as the Server
- Printing Pictures
- Other Printing Systems
- External Links
- See Also
The Debian Installer presents a Print server task for installation when additional software is offered as an option. This will bring in many of the printing-related packages Debian has available. The resulting system will be as complete as it can be and users setting up a print queue (remote or local) will have sufficient Debian printing resources at their disposal to do so. It takes but minutes to install a print queue with lpadmin, the web interface of CUPS, HPLIP, system-config-printer or cups-browsed and, after that, successful printing is usually ensured if the printer is supported by one of the installed packages.
If you passed up the opportunity to have a print server installed via the installer, you can get exactly the same set of packages after booting into the new system:
apt install task-print-server
Otherwise, a basic, functional set of packages will be obtained with
apt install cups
All-in-all, installing the task package is probably a good move if you have little motivation for sorting out which printer driver is suitable for a particular printer after installing the cups package. printer-driver-gutenprint is a package recommended by cups and would normally be installed with the previous command. It provides a wide selection of good quality drivers, but it may be desirable additionally to install one or more of the following:
For a printer which requires a non-free driver you will have to see for what the manufacturer has to offer.
A goodly proportion of the material on the Printing Portal pages, including the previous section, concerns printer drivers (free and non-free) and PPDs and setting up a print queue with them. However, it is as well to be aware that drivers and PPDs are deprecated in CUPS and eventually they will not be catered for as they are now. This has been a long-term objective of the CUPS project for some time.
Users are urged to consider the following points and explore a driverless printing solution for their printing needs, whether or not the deprecation is a motivating factor,.
Printers sold in the last 10 years or so support driverless printing, particularly those that are compatible with AirPrint.
Adding a Printer
CUPS has a web interface for setting up a print queue and administering printers. An Add Printer screen is shown below. The Discovered Network Printers section could be empty and the HP entries are only present when HPLIP is on the machine. It is suggested to read the HPLIP wiki entry before setting up a queue with the hp backend of HPLIP as a destination.
There are three sections. The first is for local printers; that is, printers which are usually attached to the machine you are using. These are very often printers using a USB connection but can be parallel or serial port printers.
Adding a USB printer is a common occurance and one should automatically be detected as a local printer and a URI (Unified Resource Indicator) for its connection displayed on the next page. With a driver on the system or supplied by the user the remainder of the queue setup should proceed successfully to completion. Administration of the queue from the web interface includes facilities to modify or delete it, set default options for it, pause or resume printing, reject jobs and edit /etc/cups/cupsd.conf.
The second section is for printers or print queues which have been discovered on the local network. Entries with @ in their description are print queues. Without the @ they are printers. The same print queues are automatically discovered by cups-browsed and become available as local queues, making it unnecessary for them to be set up from the web interface unless that is what is wanted.
A discovered network print queue/printer should be capable of being added just as easily as a USB printer. Its connection will be worked out for you and given on the second page. If the connection begins dnssd://... you should select RAW as the Make/Manufacturer on the third page. The server receiving the job will be doing the filtering so it should be sent there unprocessed. Unless the printer itself can process the document format of submitted jobs a PPD will have to chosen for the setting up of it.
The Other Network Printers section requires you to specify the destination for the remote print queue/printer, which could be on the local network or many kilometres away. AppSocket is almost always available on a network printer and other devices and requires only the IP address of the printer and a port number. An Internet Printing Protocol (IPP) URI is the preferred choice for connecting to another CUPS server because it is CUPS' native protocol. ipp14 is the ipp backend from CUPS 1.4 and Debian-specific. It was provided (but is no longer installed) because some devices did not work with the current ipp backend, which has a stricter adherence to the IPP standard. A Line Printer Daemon (LPD) URI could be considered if the remote printing service does not support IPP satisfactorily or at all. As before, when a remote print queue is doing the filtering choose RAW as the Make/Manufacturer.
Printer Status and Control
For a full picture of whether the scheduler (cupsd) is running, what the system default destination is, whether a local queue is accepting jobs and what is yet to be printed you can use lpstat:
On Debian 10
lpstat -l -e
will show all available destinations (local and remote).
For displaying or setting print queue options and defaults:
lpoptions -p <print_queue_name> -l
Stopping and starting print queues. Acceptance and rejection of jobs sent to a destination:
cupsdisable <print_queue_name> cupsenable <print_queue_name> cupsaccept <print_queue_name> cupsreject <print_queue_name>
Cancel all jobs on a destination and additionally delete job data files:
cancel -a <print_queue_name> cancel -a -x <print_queue_name>
Print to a PDF
The primary purpose of a printing system is to put toner or ink on a medium and have an output which is professional looking and suitable for the user's needs. However, the files produced at various stages of the ?filtering process can also be of interest and use to a user. For example, there was time when converting a file to a PDF from an application was not the most straightforward of tasks. A solution was to use cups-pdf as a virtual PDF printer in the application's print dialog. The output PDF is not sent to a real printer but stored on disk. Since then many applications have acquired Print to PDF and Export to PDF options in their dialogs and the situation has improved.
cups-pdf is a backend filter which takes a PostScript file and converts it to a PDF with Ghostscript. It works in conjunction with the CUPS filtering system, which becomes responsible for producing the needed PostScript using /etc/cups/ppd/PDF.ppd and passing it to the backend. The package containing the backend and the PPD is installed with
apt install printer-driver-cups-pdf
The installation sets up a print queue with the name PDF. The queue will appear as a printer in an application's print dialog and in the output of lpstat -t. Printing from the command line is done with
lp -d PDF <file_to_be_converted>
The PDF file produced is stored in a user's home directory in the PDF directory, created after the first ever job is sent.
A PDF may or may not be searchable or capable of having text copied from it. PDFs produced from PostScript files submitted to a queue generally do have these features; PDFs from text files do not because they are first filtered by texttopdf.
Alternative Configuration Methods and Utilities
system-config-printer is a printer administration tool which first appeared in Fedora and later in Debian and Ubuntu. The purpose of the tool is to configure a CUPS server (often the local machine) using the CUPS API (Application Programming Interface). The tool is written in Python, using pygtk for the graphical parts and with some Python bindings (pycups) for the CUPS API. It is largely the same as using the CUPS web interface for configuring printers but is a native application rather than a web page. It has a small section to itself on the wiki.
Specifically for HP printers, hp-setup is included with the HP Linux Imaging and Printing project package, hplip. It performs setup of USB, parallel, network printers and all-in-ones. Network printers can be automatically detected via mDNS (aka Bonjour on Macs). Using hp-setup to install a printer also enables hp utilities for checking ink/toner level and printer maintenance. Run hp-check -r to troubleshoot printing or scanning issues.
lpadmin is the fundamental way to set up a print queue and is depended on by the CUPS web interface, system-config-printer, cups-browsed and hp-setup. Command line only, but very useful if you know exactly what the printer destination is and what driver to use.
CUPS as Print Server for Windows Machines
You can setup CUPS to allow Windows machines to print to a CUPS server using an http address.
First, install the samba package. When you are asked to use WINS, say yes.
$ apt install samba
Next setup your /etc/cups/cupsd.conf file.
# Our private connection we listen to Listen *:49631 # Allow machines on local network to use printers <Location /printers> Order allow,deny Allow 192.168.0.* Allow 192.168.1.* </Location>
This will listen on port 49631 from any network. You may use some other port number besides 631. Note that the dynamic and/or private ports as specified by the IANA are in the range 49152 through 65535. Also, this will only allow computers from the local network to print to the CUPS printers.
Next, restart the CUPS daemon
# service cups restart
Now on each Windows machine, Choose that you want to install a network printer and that you want to install a printer on the Internet or home/office network. The URL you will use should be:
Lastly, the driver to install is in the Generic section labeled MS Publisher Color Printer.
CUPS and Samba
This section needs updating as you can setup print server via samba print sharing just by uploading drivers.
When printing to windows printers in an NT domain using SMB the Device URI should read
This allows Samba to authenticate against a domain controller for acces to the printer queue.
You may also omit the username:password@ part when the server does not need authentification. As the hostname both, a windows computer name or an IP address would work. To determine the printername you may use the smbclient command line tool. Run the following command, where computername refers to the name of the machine that shares the printer:
smbclient -L computername
Check the ouput for entries with Type "Printer":
$ smbclient -L base Sharename Type Comment --------- ---- ------- print$ Disk Druckertreiber HPOffice Printer HP Officejet J4500 Series ADMIN$ Disk Remoteadmin C$ Disk Standardfreigabe
The resulting URL from the output above would be
When printing to a Debian CUPS printer from a machine that connects through Samba, you may need to set up a CUPS class to get things to work.
Printer Sharing Using Macintosh as the Client and Debian as the Server
You have a printer on a debian machine and you want to share it with a Macintosh, so that the Mac can print to the Debian-based printer. Try this:
1. Use cups to set up the printer on Debian as described above. The Gnome tool for printer configuration works well, and the 100% bullet-proof way is to use the browser-based CUPS configuration.
2. On the Mac (OS X 10.4+) start Print and Fax from System Preferences. Use the + button to add a printer.
3. Look first in the "Default" tab. If the automagic printer-sharing has worked, and your Mac is connected to the local network properly, then the Debian-based printer should already be visible in the list. Just select it and use the recommended print driver. Your results may vary but you can't go to far wrong if you pick a driver that matches the one you are using on Debian. So, for example, you might like to try using Gutenprint drivers at both ends.
4. If your printer is not visible in the Default tab, then try adding it on the "IP" tab. Pick IPP as the protocol, give the plain IP address of the server in the address box, and in the Queue box put "printers/<debian-queue-name>". Put whatever helps you identify the printer in the Name and Location boxes, and choose a printer driver than matches what you used to set up the printer on Debian. Finally cross your fingers, hold your breath, recite a prayer/spell/incantation, and press the Add button.
As they say: your mileage may vary.
Professional looking photos may be obtained when using high quality glossy photo paper on an inkjet printer but care must be taken when submitting the print job. Printing from The Gimp image manipulation program produces very good results. The print dialog will vary depending upon the printer used. The most important settings are type of paper, glossy photo or whatever sort you are using, and image type, "photograph". The size of the printed image is adjusted in the printer dialog as well.
Other Printing Systems
Debian has several alternatives available for printing:
CUPS. (Instructions above.) The newer Common UNIX Printing System (or CUPS) is a printing system and general replacement for lpd and the like. It supports the Internet Printing Protocol (IPP), and has its own filtering driver model for handling various document types.
LPR. The still commonly used traditional printing system is called lpr which works quite well if you have a postscript printer. Otherwise, it is not very simple to set up and doesn't provide much control for users on the printer settings per print job.
RLPR Remote line printer spooling system.
xpp is designed to be able to take the same command-line arguments as BSD-lpr and SysV-lp so most apps won't realize the difference if you create a symbolic link from /usr/bin/lpr (or /usr/bin/lp) to /usr/bin/xpp. This way, whenever an application sends off a print job to the lpr (or lp) program, xpp will launch its GUI so that you can select the options that you would like for this job.
These alternatives are maintained by different groups. But there is a lot of collaboration and coordination between them, which occurs on the debian-printing list.
system-config-printer - GTK+ graphical user interface to configure a CUPS server