PIC
 

Printing from DCI Unix systems

Michael A. Dickerson
|
7 Jun 2004
This document is available in PDF and HTML from http://www.dci.pomona.edu/docs.
______________________________________________________________________________________________________________________________________________________________________________

DCI systems can print to many of the printers on the campus network. This is accomplished using software called the Common Unix Printing System, or CUPS, provided free of charge by Easy Software Products1 . To get started, decide what printer you want to print to. The DCI print queues are named for the printer’s location. The command lpstat -s will display a list: $ lpstat -s  
system default destination: andrew252  
device for andrew151: lpd://pom-andrew151-laser2.pomona.edu/auto  
device for andrew158: lpd://pom-andrew158-laser1.pomona.edu/auto  
device for andrew252: lpd://pom-mathcs-laser3.pomona.edu/auto  
device for andrew253: lpd://mathprt0.pomona.edu/auto  
device for andrew259: lpd://mathprt1.pomona.edu/auto  
device for andrew265: lpd://pom-mathcs-colorlaser2.pomona.edu/auto  
device for brackett: lpd://pom-brackett-hp4550-clr.pomona.edu/auto  
device for millikan122: lpd://pom-millikan122-physics-hp2200.pomona.edu/auto  
device for millikan122c: lpd://pom-millikan122-astro-hp4550.pomona.edu/auto  
device for millikan220: lpd://pom-mathcs-laser6.pomona.edu/auto  
device for millikan226: lpd://pom-mathcs-colorlaser1.pomona.edu/auto

If the file to be printed is one of the types understood by CUPS, as is usually the case, you can print it directly from the command line.

1 Printing from the command line

The lp command submits a file to be printed. You may use the -d option to select the destination:

$ lp -d millikan122 big_happy_file.txt  
request id is millikan122-47

If the system default printer (displayed first in the lpstat output) is acceptable, you may omit the -d option:

$ lp thesis.ps

The CUPS print server understands a variety of file types, including at least the following: plain text, Postscript, PDF, HTML, GIF, PNG, JPEG, and TIFF. It should be possible to use lp to print files in any of these types.

2 Printing from within applications

Many applications have some kind of print command built in. Most of these merely execute a program that you specify (such as lp) and send their output to that program. In these cases, you can just enter lp -d yourprinter as the print command and you should be fine. This works with at least Netscape, Mozilla, and the Acrobat Reader.

Other applications, especially old and clunky ones, might attempt to print in other ways, possibly even assuming you have a printer attached to a parallel port on your workstation or some other such asinine idea. In these cases you will have to check the documentation for the individual program and hope for the best.

2.1 Printing from OpenOffice 1.1

Most OpenOffice packages after version 1.1 have integrated support for CUPS printing. The “Print” dialog in OpenOffice will list all of the available print queues by name (such as andrew252), and you should be able to print to any of them without further assistance.

3 Managing the queue

After submitting a plain text file, the printer should react in just a few seconds. Large Postscript jobs may take a minute or two, although the printer will usually do something to indicate that it is processing in the meantime. You can check the status of your job with the lpq command. This command wants you to specify the name of the printer with the -P option:

$ lpq -P millikan122  
millikan122 is ready  
no entries

If a job is stuck or otherwise not to your liking, use the cancel command with the job-ID that was given by the lp or lpq command2 :

$ cancel millikan122-4770

If your jobs disappear from the queue but do not come out of the printer, you are probably sending them to the wrong printer.

4 Confronting the stairstep problem

The newer HP printers are supposed to automatically recognize whether a job is plain text or Postscript, and for the most part they seem to do this. Some older printers, however, do not interpret the end-of-line character correctly. This is called the stair-stepping problem:

Party List:  
           mikey  
                sarah  
                     biji  
                         tom  
                            millie  
                                  elena...

If you find that your printer suffers from the stair-stepping problem, the most reliable way to fix it is to kludge the carriage return characters into the text stream yourself. One relatively painless way to do this is:

$ cat party_list | awk '{printf "%s\r\n",$0}' | lp -d printer

Of course, if you find you have to do this often, you should probably create a shell script to save keystrokes and delay the onset of carpal tunnel syndrome.

5 Managing printers from the Web interface

You can investigate printers and jobs in the queue from a Web interface installed on the server. Go to http://cups.dci.pomona.edu:631/. The complete CUPS documentation is also available at this location.

6 Installing new printers

The CUPS client programs send all of their jobs to a central print server. Therefore, it is believed to be impossible for you to add a new printer yourself. Please ask your system administrator if you wish to use a printer that is not already available. It is trivial for me to attach most networked printers.

1 http://www.easysw.com

2The lprm command works exactly the same as cancel.