Translation(s): العربية - Ελληνικά - English - Français - Italiano - Polski - Русский - 简体中文


A basic view of the CUPS printing system.

Software Installation

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 or system-config-printer 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-get install task-print-server

Otherwise, a basic, functional set of packages will be obtained with

apt-get 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 what the manufacturer has to offer.

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.

printers-2.2.png

Use your favourite browser (firefox, chromium, lynx, elinks etc) to display the interface and add a printer via the Administration screen. If you are asked for a username and password see here.

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 preferrred 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 is provided because some devices do 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 queue is accepting jobs and what is yet to be printed you can do

lpstat -t

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>

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-get 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 methods for PDF production can be based on using cupsfilter and cups-tea4cups.

Alternative Configuration Methods and Utilities

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

http://<cups_server_hostname>:49631/printers/<printer_name>

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

  smb://username:password@domain/server/printername

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

  smb://base/HPOffice

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.

Printing Pictures

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:

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.

See Also