- Note: These instructions apply to UNIX workstations. If using a Windows workstation, please view the Windows instructions for Adding/Removing printers.
There are a series of laser printers located throughout the computer rooms in the Institute. We would encourage all users to preview files on the screen when possible (using xdvi, acroread and ghostview) instead of printing them and, whenever possible, to print things at half size side by side (using enscript or psnup, described below).
The printer names are generated from their location... eg. the black and white laser printer in T14 is called lpt14 and by default jobs sent to that printer are printed double sided.
Printing will be done on your `default printer', which is defined by the value of the `environment variable' PRINTER. This environment variable is set when you log in to be a printer that is `close' to where you are sitting. The default printer is reported at the end of the `Message of the Day' message. This default however does not survive across a telnet, ssh or rlogin.
To check which printer is set type
at the command prompt.
To explicitly set the printer environment variable type
setenv PRINTER <printer-name>.
Printing commandsThere are a series of commands for printing out files:
This is the standard command and can be used for printing the following file types: plain text (txt), postscript (ps), pdf (in most cases, otherwise use acroread), jpg, gif, bmp, png. At present it does not print other image formats for which you should use a suitable application, e.g. display, gimp, xv.
lpr -Pprinter filename
Note that there is no space between the -P and the printer name.
To print the file data.ps on the printer lpg17 type
lpr -Plpg17 data.ps
Note provided your PRINTER is set there is no need to include the -P option.
This is used for printing out a DVI file (a file produced after processing a TeX file). It is invoked using
dvips -Pprinter filename.dvi
To specify the first page to print from use the -p option and for the last page the -l option, e.g.
dvips -Pprinter -p 5 -l 10 filename.dvi
to print pages 5 to 10 inclusive.
It can also be used for converting the DVI file to a POSTSCRIPT file by using
dvips filename.dvi -o filename.ps
Note: dvips outputs by default to the lpr command (without additional options) . If you need to supply options to the lpr command as well (e.g. see below for forcing single sided printing etc) then you need to use the -o option to output to standard out and pipe that to a suitable lpr command, e.g.
dvips -o - filename.dvi | lpr -o sides=one-sided
Duplex (Double-sided) printing
Most public printers have duplex units fitted which enables them to print double-sided. Where possible the default print queue is always set to the duplex queue.
If you are printing a landscape document then the default duplex tumble will mean the backs are upside down.
To rectify this you can add an option to the print command as follows:
lpr -o sides=two-sided-short-edge myfile.pswhich changes the duplex tumble from the long edge to the short edge.
Single sided printing
If your default printer prints doubled sided and you wish to print a document in single sided mode then use
lpr -o sides=one-sided myfile.ps
Sometimes you may want to print more than one original document page per single side of paper. You can do this with an extra print option:
lpr -o number-up=2 myfile.ps
which puts 2 original pages to each side of paper. The number up option supports 2, 4, 6, 9 and 16 to a side.
In the case of 2 up you may also want to use the two-sided-short-edge option as explained above to get the backs the right way up.
When printing transparencies first make sure you have the right type as the wrong ones can cause several hundred pounds worth of damage. Transparency types:
- Colour laser printer transparencies - only use in colour laser printers
- Black and white laser printer transparencies - only use in b/w laser printers
- Photocopier transparencies - never use in a printer!
- Write on transparencies - never use in printers or photocopiers!
where you need to specify the printer_name, e.g. lpt14-colour, lpd28-colour. Also remember to use a page range option if appropriate.
lpr -P printer_name -o sides=one-sided -o media=Transparency filename
Other option to lpr that may be useful
- -o landscape
- -o page-ranges=1-4,7,9-12
- -o page-set=odd
- -o page-set=even
- -o outputorder=reverse
- -o prettyprint
- -o scaling=90 (scale to 90% the size of the page)
Note: Some graphical print applications may write settings to a file
~/.lpoptions which will override some command line options. A common symptom of this is the failure of the sides option to have any effect. To `fix' the problem remove the .lpoptions file and retry.
Checking the print queue
The printing system is a distributed system with most printers being controlled by print servers although some users have locally attached printers. In addition the printing system is highly available and when a client machine wishes to print a job it sends it to the least loaded remote print server (this can result in two subsequent jobs going to the printer via different servers).
When the printer is controlled by the local machine you can view the current print queue by typing
To remove a print job from the queue use
where <job-number> is the job number as reported by lpq.
If the printer is being controlled by a remote print server the you need to check the remote print queue. Using the lpq command will only report the queue on the local machine which will generally be empty since it will have handed the job off to the print server.
To check a remote queue on a given machine you can use the lpstat command. The network printer queues are hosted by the machines print1 and print2.To check the queue for printer lpd28 on server print1 you would run the command
lpstat -h print1 -o lpd28
To remove a job from a remote queue, say lpd28 on print1, you can use the cancel command, e.g.
cancel -h print1 -u <username> lpd28-<job-number>
where you need to replace <username> and <job-number> by the username and the job number as given by the output of lpstat. For example if the output of lpstat for print1 looks like
then the job is on printer lpd28 with job number 5706 and the username is smith so you run the corresponding cancel command would belpd28-5706 smith 1024 Wed 05 Apr 2006 07:59:14 BST
cancel -h print1 -u smith lpd28-5706
Graphical Print Tools
Graphical applications will typically have a builtin print option. This may bring up a simple dialog where you can modify the print command which by default is likely to be lpr or it may be a fully featured tool that queries the printer configuration and allows you to select printers and print options from various drop down menus.
There are also general graphical print tools such as
xpp. These tools can also be useful if you wish to browse the list of available printers.