How to print with CUPS

Starting with Debian Squeeze we migrated to a new printserver https://cups.gsi.de:631 using the Common Unix Print System (CUPS). CUPS offers better control over printing options and more features, also the previous system (rlpr, LprNG) is not well supported by the applications any more.

New printer names

With CUPS there is only one queue per printer, eg. p280gcs, p280gcd, p280wcs and p280wcd are all p280 in CUPS and the printing options have to be specified either in the print dialog or on the command line.

Printing from command-line

To get a list of the available printers use lpstat -p. The default printer can be selected and set with lpoptions -d printer.

For printing itself use the lp command. Here is an example: lp -d p280 vi.pdf.

If you want to use a printer with special options you can define them using the common job options with the -o parameter. For more details type man lp or take a look at https://cups.gsi.de:631/help/man-lp.html.

Alternatively you can use gtklp to open a printing dialog where you can select the destinatiom printer and set the desired options. The similar KDE-native utility kprinter has unfortunately disappeared with KDE 3.

lpr compatibility

CUPS also provides a lpr command that may serve as a drop-in replacement for the previous rlpr (anyhow keep in mind that the print queue names changed). Its options are documented in the man page (man lpr) or at https://cups.gsi.de:631/help/man-lpr.html.

Printing from KDE

Printing from KDE works for all KDE programs straightforward. Just use the Print button or menu entry of the program and you get a printing dialog with all available printers included. The options for your document can be set there.

Known problems:

  • In LibreOffice sometimes it is necessary to open the printing dialog twice. Sometimes the printers are not listed at the first try. So don't worry, just click Cancel and start the printing dialog a second time.

Printing posters

PDF files already contain size information. The CUPS server adheres to these dimensions and ignores user options like -o scaling=…. Therefore PDFs have to be converted to the desired size. This can be done on the command line using ghostscript:
gs -sDEVICE=pdfwrite -sPAPERSIZE=desired_paper_size -dFIXEDMEDIA -dPDFFitPage -dCompatibilityLevel=1.4 -o converted.pdf input.pdf

Alternatively the option -o fit-to-page can be used to scale to the printers maximum. Anyhow additional media options seem to be ignored. So eg. lp -d p210 -o fit-to-page -o media=a2 will produce printouts actually (much) larger than A2.

Printing into PDF documents

For creating PDF documents the CUPS-PDF driver is installed. The name of the pdf-printer is just PDF-Printer .

Printing somthing on PDF-Printer creates PDF documents that are stored in your home directory. It's not possible to set a file name or location. You have to move or rename the PDF afterwards by hand. The file name will be equal to the title of the document and if no title is found by the virtual printer, it will be some criptic name (hint: search for the newest file in your home directory).

Many applications have built-in support for PDF generation, e.g. Print to file in Iceweasel/Firefox, Export as PDF in LibreOffice etc. It is recommended to use these built-in functions for optimal results.

Handle your print jobs

Show jobs

If you want to see, if you have any jobs still trying to print, use the command lpstat -u username . The output should look like this (one job for example):
p906-1700            testuser       184320   Di 01 Apr 1912 02:42:42 CEST
p906 is the printer. 1700 is the job id. testuser should be your username and 184320 is the size of your document, which should be printed.

Delete jobs

To delete a job, you first have to determine the job id. Use the command lpstat -u username lioke described above. Then use cancel JOBID to cancel the print job. If you get no message, it should have been successful. If you want to be sure, use lpstat -u username again to check it.

-- JanTrautmann, ChristopherHuhn - 2012 - 2015
Topic revision: r8 - 2015-09-21, ChristopherHuhn