DESY HOME IT HOME Print Preview Print Window

CUPS on Scientific Linux

Available CUPS server

Due to the large number of printers and queues on site, the printer have been divided onto several CUPS server each serving only a subset of the available printer. Available CUPS server are:

For Information on CUPS at Zeuthen, refer to their Printing_with_Cups documentation. Note: a good deal of the information below originates from the Zeuthen page and is just replicated here.

System-wide CUPS configuration

The CUPS server at DESY is running on a central system. Actually, due to the large number of printer queues available, several CUPS instances serving a (group-specific) subset of printers have been implemented. For example, cups-hasylab provides all public printers as well as all hasylab printers. The CUPS server is pre-determined for each linux-host depending on the group the host belongs to. This is set in a single CUPS configuration file, /etc/cups/client.conf:

ServerName cups-hasylab.desy.de

The default print backend is usually specified in

/usr/share/config/kdeprintrc
/etc/gtk-2.0/gtkrc

Personalizing the CUPS server

If you are unhappy with the default settings on a specific host or system, you can easily customize the CUPS server and printer configuration. However, some of the customizations are application specific.

Customizing print services for KDE

It is possible to customize the print engine via the kprinter application. After starting kprinter,


click on the "Expand" button to see the advanced options:


Select CUPS as the Print system.

The system option allows you to set the CUPS server or filter the printer lists for all KDE-applications. The configuration will be stored in

~/.kde/share/config/kdeprintrc:[CUPS]
~/.kde/share/config/kdeprintrc:Host=cups-z



Alternatively, the KDE print configuration can be customized through the Control Center. The printer entry under peripherals

provides additional information about available printers, allows to define the CUPS server as well as the default printer. Since the CUPS server is running on a remote host and not the local machine, further customization of printer queues or adding new printers is not possible! Since ~/.kde is often a link to a Operating System specific directory, it is possible to apply different settings for different operating systems.

Customizing print services for other applications

Not all applications will actually use the KDE print engine. For example firefox or acrobat reader use a different configuration scheme. Acrobat reader will look in the users homedir for files .cupsrc or .cups/client.conf to define the print server. Adding a line like

ServerName cups-z.desy.de

in .cupsrc or .cups/client.conf will override the system-wide settings. This way you can define the CUPS server for most non-KDE applications independently. Adobes Acrobat Reader for example will read the configuration files everytime the print dialog is opened, so any changes to .cupsrc or .cups/client.conf will be recognized instantaneously. Firefox in contrast needs a restart to update the print configuration.

Some applications like inkscape seem to use exclusively a pipe like '|lp' for printing. Alternatively, using '|kprinter' provides a convenient way to select printer and printer configuration for such applications without the need to know exactly the lp options and printer names.

Noteworthy, the SL4 and SL5 cups versions are quite different and behave slightly different. For example, some applications under SL4 will ignore the settings in ~/.cups/ and exclusively rely on ~/.cupsrc or ~/.lpoptions. Applications running under SL5 in contrast will usually read both set of files, but settings in ~/.cups/ seemingly override those in ~/.cupsrc or ~/.lpoptions.

Printer configuration

The configuration of individual printers can be customized through the applications print dialogs or with lpoptions:

 lpoptions -p pubcp1 -l

will list all options set and available for printer pubcp1. The default settings for this printer can be changed for example by

lpoptions -p pubcp1 -o duplex=DuplexNoTumble     # set duplex 
lpoptions -p pubcp1 -o duplex=none               # print single sided
lpoptions -d pubps2                              # make pubps2 the default printer

The user-specific settings created by lpoptions are stored in

~/.lpoptions           under SL4
~/.cups/lpoptions      under SL5

Printing from the command line

Printing from the command line under CUPS is fairly identical to the behavior under LPRng. However, CUPS and LPRng use quite different syntax for options parsed to the printer, so that it's not possible to use LPRng commands from (e.g.) acrobat reader once CUPS is enabled. Since it might occasionally be favourable to use LPRng printing syntax, the LPRng binaries are available under different names as

   /usr/sue/bin/slpq       or just slpq            == lpq     (LPRng)
   /usr/sue/bin/slpr               slpr            == lpr     (LPRng)
   /usr/sue/bin/slprm              slprm           == lprm    (LPRng)
   /usr/sue/bin/slpstat            slpstat         == lpstat  (LPRng)
    
   Use for example slpq -h to get some help 

Deleting print jobs

Note: Since the CUPS server parses the print jobs to spool-lpr, print jobs will rapidly disappear from the list of active jobs, cancelling the jobs will thereafter only be possible with LPRng-commands slpq, slprm (see above).

Use the (s)lpstat command to list the jobs for a particular printer. Using (s)lpstat prints the status of all your print requests made by lp to the default or designated printer. To see the status of print jobs you have sent to the queue of the default printer that are still waiting:

  lpq -l             or better ...
 slpq -l

To check what jobs are pending for a particular printer, use the (s)lpstat -p command. For example, to view the queue for printer pubcp1:

  lpstat -p pubcp1   or better ...
 slpstat -p pubcp1

Use the cancel command to stop the printing of a file. To cancel a job, even if it's already printing, use the lpstat command to find the job number. Then use the cancel command to kill that job. For example, if you want to kill the job pubcp1-4, enter:

  cancel   pubcp1-4  or better ...
  slprm  -Ppubcp1 4

kjobviewer offers the same functionality via its graphical user interface:

Overview of Cups Printing Options on UNIX (from DV-ZN)

Printing Options are passed to Cups using the -o Option of lp and lpr:

Option Meaning Example Comment
sides=one-sided disables duplex printing lpr -o sides=one-sided testpage.ps use printer/simplex if supported
sides=two-sided-short-edge enables duplex printing for landcape pages lpr -o sides=two-sided-short-edge myfile.gif
sides=two-sided-long-edge enables duplex printing for portrait pages lpr -o sides=two-sided-long-edge info.txt default
page-ranges=RANGE not the complete document is printed, but only the specified pages lpr -o page-range=1,3-5,7 textfile only for ASCII-text
number-up=number places multiple document pages on a single printed page lpr -o number-up=4 project.pdf supported are: 1, 2, 4, 6, 9, and 16
Resolution=xxx changes printers resolution lpr -o Resolution=600dpi testpage.ps lpoptions can be used to find out supported Resolutions fo a queue:  lpoptions -p queuename -l |grep Resolution 
media=Transparency prints on transparent Media lpr -o media=Transparency talk.ps use printer/transp if supported
PageSize=A3 prints on DIN A3 paper lpr -o PageSize=A3 picture.gif use printer/A3 if supported
scaling=number The scaling value is a number from 1 to 800 specifying the size in relation to the page (not the image.) lpr -o scaling=100 pict.gif can be used for image formats (GIF,JPEG,TIFF,...)
landscape rotate the page 90 degrees to print in landscape orientation lpr -o landscape picture.jpg
orientation-requested=N rotates the page depending on the value of N lpr -o orientation-requested=4 file.ps possible values: 3: no rotation, 4: 90 degrees, 5: 270 degrees, 6: 180 degrees
job-sheets=none do not print bannerpages lpr -o job-sheets=none file.ps
cpi=NUMBER scale font to NUMBER characters per inch lpr -o cpi=9 textfile only for ASCII-text
lpi=NUMBER scale font to NUMBER lines per inch lpr -o lpi=9 textfile only for ASCII-text, this overwrites the cpi-option

Troubleshooting

If you are still running LPRng and would like to migrate to CUPS or if you are unhappy with the default print server, please contact unix@desy.de. Note: migration is only possible for SL4 or newer. If the OS is SL3 or older, upgrading the OS is the only option.

If you believe that a printer is missing from a particular server or see discrepancies between printer configuration and capabilities, please contact printing@desy.de.

For all other questions consult the FAQ or drop a message to UCO.
 

Frequently Asked Questions (from DV-ZN)

Which file formats can Cups process ?

Which applications do offer a tight cups integration on a UNIX system ?

How can I select the simplex mode on a duplex printer under UNIX ?

How can I change personal printer specific option settings?

How can I print multiple copies of a document using the CLI?

Copies are not collated by default. Use the -o Collate=True option to get collated copies:

How can I change the layout of the output pages when using N-Up printing?

In order to change the borders around each page, use the -o page-border=value option. Supported borders are:

Example: lp -o number-up=4 -o page-border=double myfile. In order to change the arrangement of the pages on each output page, use the -o number-up-layout=value option.Possible values are:

Explanation: The default layout is lrtb(Left to right, top to bottom). This means: using a number-up of 4, the first page will be printed on the top-left of the outputpage, the second page will be printed on the top-right, the third page will be printed on the bottem-left and the fourth page on the bottom-right of the outputpage. Example: lp -o number-up=4 -o number-up-layout=btrl myfile

I do get printouts sometimes in letter format, why A4 is not the default?

What is the best way to print man pages ?

To print man pages use: man -t <man-doc> | lp ...

How can I print utf-8 encoded text?

To print iso8859-1 characters encoded in utf-8, just print the file as usual. Cups will select the correct filter automatically. If you want to print non-iso8859-1 characters (e.g. Cyrillic or Chinese characters):

I'm using psutils (pstops,psnup,psbook). Even though I'm using the option ''sides=two-sided-short-edge'' the output was not arranged in the correct order. What can I do?

I'm using psutils (pstops,psnup,psbook). On the Xerox Color Printer I get wrong output with a different font. What can I do?

Can I change the fontsize when printing ASCII-text?

YES! The size of ASCII-text can be changed by using the cpi (characters per inch) or lpi (lines per inch) options. Unlike Cups-default, the cpi -option will be ignored if both options are present. Default is a value of 80 characters per virtual line in portrait, and 113 characters per virtual line in landscape mode. This means a value of round about 9.7 characters per inch.

I can't print the postscript file. What can I do?

I'm using ps2pdf, but the generated pdf file was incomplete. What can I do?

I'm at DESY Hamburg and working on Zeuthen's systems. Is it possible to print on Hamburg printers?

I'm missing the bannerpage when I print from OpenOffice, what can I do?

On SL4 I get the message "unable to print file: client-error-bad-request" ?

Printing from Linux/MacOS Notebooks

using cups

Use one of the following two methods to let your local cups communicate with our server. Afterwards you can use cups as described above.

use a local cups-daemon
bypassing the local cups configuration
permanent configuration without local cups-daemon

If you have no local cupsd running, just change the Servername directive in /etc/cups/client.conf to cups-public.desy.de



Imprint © 2013 Last update: 24. Aug. 2010 uco@desy.de