Linux Printing
Computer Center
Linux Printing
1. Printing with Cups Server ZNCUPS
2. Overview of Cups Printing Options on UNIX
3. Printing from Linux Notebooks
4. Frequently Asked Questions
1. Printing with Cups Server ZNCUPS
The Common Unix Printing System (CUPS) is the central printing system on all UNIX machines at DESY Zeuthen.
1.1 default printer: set LPDEST to your favorite printer
- edit $HOME/.zprofile and add or modify the line
export LPDEST=your_printer - make a new login or run in every window
. .zprofile - please check your .zshenv too and remove LPDEST entries
- edit $HOME/.login and add or modify the line
setenv LPDEST your_printer - make a new login or run in every window
source .login - please check your .cshrc too and remove LPDEST entries
1.2 Printing with the CLI (command line interface)
- using lpr:
lpr -Pprinter myfile
- using lp:
lp -dprinter myfile
1.3 Examining the print queue with the CLI
- display a specific queue:
lpstat -pprinter
- display all available queues:
lpstat -p
- list all active jobs:
lpstat -o
1.4 Cancelling of print jobs with the CLI
The CUPS job on the local system gets a job-id which is not suitable for removing a job on the print server. The job-id on the print server is different, it can be displayed using lpstat. After finding out the job-id on the print server you can remove it. Use cancel and no longer lprm for removing your print jobs.
Examples:
- cancel your last job on printer with:
cancel printer
- cancel specific jobs: first get the job-ids using lpstat, afterwards use cancel:
[myhost] % lpstat -o
znrz1-31 ottostr 1688576 Thu Jan 4 12:20:51 2007
znrz1-32 frida 31596544 Thu Jan 4 12:20:55 2007
znrz1-33 wwinzig 1654900 Thu Jan 4 12:30:57 2007
znrzc-34 ottostr 61533324 Thu Jan 4 12:32:13 2007
[myhost] % cancel znrz1-31 znrzc-34
2. Overview of Cups Printing Options on UNIX
Printing Options are passed to Cups using the -o Option of lp and lpr:
lpr -o option1=value1 -o option2=value2 [...] file
lp -o option1=value1 -o option2=value2 [...] file
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-ranges=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 Resoltions 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 characters per inch |
lpr -o lpi=9 textfile |
only for ASCII-text, this overwrites the cpi-option |
For more options and additional information see the "Cups Commandline and Options Manual".
3. Printing from Linux Notebooks
3.1 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.
3.1.1 use a global cups-daemon
- If you want your Cupsd to communicate with the server permanently, just add the line Browsepoll zncups.zeuthen.desy.de to /etc/cups/cupsd.conf and restart the cups-deamon by typing
/etc/init.d/cups restart
as root. From now on, the cups-daemon will comunicate with zncups every time cups is started. - If you just want to add a printer permanently use the usual "add new printer" dialogue and provide the name of the queue which is the printers name and the IP address of the server
- or run as root
lpadmin -p <my_printer_name> -E -v
ipp://zncups.zeuthen.desy.de/printers/<printer_name>
3.1.2 bypassing the local cups configuration
passing the servername to the client
- by the variable CUPS_SERVER
CUPS_SERVER=zncups.zeuthen.desy.de # zsh
lpstat -a # to see all printers
lp -d <printer> ...
- by an argument
lpstat -h zncups.zeuthen.desy.de -a # to see all printers
lp -h zncups.zeuthen.desy.de -d <printer> ...
3.1.3 permanent configuration without local cups-daemon
If you have no local cupsd running, just change the Servername directive in /etc/cups/client.conf to zncups.zeuthen.desy.de
3.2 lpr/lp based printing system
If you work with a lpr/lp based subsystem a printcap entry in your /etc/printcap file would probably look like this:
<printer_name>:\
:rm=zncups.zeuthen.desy.de:\
:rp=<printer_name>