Table of Contents Previous Chapter

CHAPTER 6 Printing

SLAC has a large number of printers from a variety of vendors that can print text, PostScript, and graphics in black and white and color on paper and foils. In this section you will learn:

Note: Many SLAC printers, in particular Imagen printers, can only print text and are not PostScript-compatible. A PostScript file sent to a non-PostScript printer will not produce the desired output, may take a long time to print, and may waste a lot of paper. By UNIX convention, names of PostScript files end in ".ps" or ".eps". Such files should be printed on PostScript printers.

Changing the Default Printer on New UNIX Accounts

Because printers are distributed across SLAC, no single printer serves a majority of UNIX users. Therefore, for new UNIX accounts the default printer has been set to InvalidPrinter. If you have a new account, first change InvalidPrinter in your.cshrc file to the name of a printer that makes sense for you. If you don't, you will receive an error message, like those given below, when you try to print. We suggest that you ask someone in your group to recommend the name of a printer, or you may be able to find one in the file /etc/qconfig or /etc/printcap (see section "Finding the Names of Printers" on page 44). To change the default printer:

1. Edit your .cshrc file (e.g., with the emacs editor).
2. In the line:
setenv PRINTER InvalidPrinter
change InvalidPrinter to a printer of your choice, e.g., hpcgb3b.
3. Save the file.
Note: The change will take effect when the.cshrc file is executed, for example, by opening a new shell window. The simplest way to ensure that it is executed might be to logout and then login.
The setenv command in your.cshrc file is preceded by this explanatory comment:

# Set the value of the PRINTER environmental variable to the name

# of your default printer. For printer names, see the file

# /etc/qconfig on AIX systems or /etc/printcap on other systems).

# The default value, "InvalidPrinter", prevents the lp command from

# accidently submitting print jobs to the batch queue.

The next section discusses the contents of /etc/qconfig and /etc/printcap.

If you try to print a file to InvalidPrinter, the response will depend on the system on which you issued the command (e.g., RS600, Sun) and the print command you used (e.g., lpr, enscript). For example:

Sun responses:

ilse@scssun1 $ lpr my-aid-file

lpr: InvalidPrinter: unknown printer

ilse@scssun1 $ enscript my-aid-file

enscript: 4 lines were wrapped because of length.

[ 2 pages * 1 copy ] spooled to InvalidPrinter

lpr: InvalidPrinter: unknown printer

RS6000 responses:

ilse@sisyphus $ lpr my-aid-file

enq: (FATAL ERROR): 0781-050 Bad PRINTER or LPDEST env. variable InvalidPrinter.

ilse@sisyphus $ enscript my-aid-file

enscript: 4 lines were wrapped because of length.

[ 2 pages * 1 copy ] spooled to InvalidPrinter

enq: (FATAL ERROR): 0781-048 Bad queue or device name: InvalidPrinter.

Changing the Default Printer for the Current Shell Window

To change the default printer for the current shell window, enter the command:

$ setenv PRINTER printer-name
substitute the name of the chosen printer for printer-name. For example, setenv PRINTER imcgb3b.
This command changes the default printer until you end that shell window. In any other shell window (including new ones) the default printer will be in effect.

Finding the Names of Printers

Either open the file /etc/qconfig on AIX (RS6000) system or file /etc/printcap on other systems in an editor or print it in a shell window. For example, the command:

more /etc/qconfig

will list one screenful of information of the file at a time. (Press the space bar to get the next screenful.) Note that both files are quite long.

The following is a sample description from the file /etc/qconfig for an Apple LaserWriter printer named lwcgb3a.:

* Computer Center Comp Group lounge

lwcgb3a:

host = lpd01

s_statfilter = /usr/lpd/bsdshort

l_statfilter = /usr/lpd/bsdlong

rq = lwcgb3a

device = rlp86

rlp86:

backend = /usr/lpd/rembak

lwcgb3a-ps:

host = lpd01

s_statfilter = /usr/lpd/bsdshort

l_statfilter = /usr/lpd/bsdlong

rq = lwcgb3a

device = rlp87

rlp87:

backend = /usr/lpd/rembak

lwcgb3a-tx:

host = lpd01

s_statfilter = /usr/lpd/bsdshort

l_statfilter = /usr/lpd/bsdlong

rq = lwcgb3a

device = rlp88

rlp88:

backend = /usr/lpd/rembak

The most useful information for most new users is:

Many printer names give a clue about the printer's manufacturer and location; in this example, an Apple Laserwriter located in the Computer Group Building on the third floor.

The same printer is described in /etc/printcap as follows:

lwcgb3a|lwcgb3a.ps|lwcgb3a.tx|wingz2|lwcgb3a|Computer Center Comp Group lounge:\

:sb:\

:sh:\

:mx#0:\

:lp=:\

:rm=lpd01:\

:rp=lwcgb3a:\

:sd=/usr/spool/lp/lwcgb3a:

Aliases for the printer name lwcgb3a are given in the first line after the first "|" character. The :ty field indicates the printer model.

The commands man qconfig and man printcap will describe the printer description fields in more detail.

Printing Files and Other Text

Print Commands

Commands you can use for printing include lpr, enscript, and pslpr. Which of these you select depends on your file, your print requirements, and your choice of printer. Remember, though, that some printers at SLAC can only print text (e.g., the Imagen Pprinters). For full reference information about these commands, enter the man command; for example, man lpr.

Two other commands you will likely find useful are:

Basic Print Command Examples

Following are examples of the lpr (print) and echo $PRINTER (display default printer) commands given on an RS6000. The default printer was changed from InvalidPrinter to hpcgb3b, an HP Laserjet 4si mx printer. Responses will vary according to the platform (e.g., RS600 or Sun) on which you give these commands and according to the printer you query (e.g., Apple Laserwriter, Hewlett Packard printer, etc.).

Examples of -Pname, the name of the printer on which you want to print, and other useful print options are given in the next section.

Jobs will be printed on the default printer, unless you specify otherwise in the argument.

WARNING!!
If you have a new UNIX account, be sure to change the default printer from InvalidPrinter to the name of the printer that you wish to use in your.cshrc file (see section "Changing the Default Printer on New UNIX Accounts" on page 43).

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ilse@sisyphus $ echo $PRINTER                                                displays default printer name; in this case, hpcgb3b                                             
                                                                                                                                                                              
hpcgb3b                                                                                                                                                                       
                                                                                                                                                                              
$ lpr  chap2.ps                                                              prints file chap2.ps on the default printer                                                      
                                                                                                                                                                              
                                                                                                                                                                              
$  lpq                                                                       queries the print queue for the default printer; job number is 30                                
Queue                            Dev                           Status   Job  Files                                                               User   PP  %  Blks  Cp  Rnk  
hpcgb3b                         rlp22                          READY                                                                                                          
hpcgb3b                         hpcgb3b is ready and printing                                                                                                                 
hpcgb3b                         hpcgb3b                        RUNNING  30   chap2.ps                                                            ilse   0   0  217   1   0    
                                                                                                                                                                              
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Specifying How the File Should Print

Some printers (e.g., HP Laserjet 4si mx) can print duplex (that is, both sides of the paper), manual feed, and select paper from one of two paper trays.(1) enscript for text files and pslpr for PostScript files let you control these printer features with the -S option (see examples below). The catch is that the features you select must match a keyword in the PostScript Printer Description (PPD) file for the printer of your choice. PPD files, which are supplied by the printer manufacturer, reside in /usr/local/lib.shared/ts/ppd,and they are not easy to read. If you can't make sense out of them, see if someone more knowledgeable in your group can help you.

--------------------------------------------------------------------------------------------------------------------------
To:                                    Give command:                                        Comment                         
--------------------------------------------------------------------------------------------------------------------------
Print header (filename, current        enscript -Phpcgb3b mydoc                             mydoc is filename of a text     
date, & page number)  on each                                                           file; hpcgb3b is printer        
page of text file                                                                           name. Omit -Pprinter-name       
                                                                                            if you want to use the de       
                                                                                            fault printer.                  
Print 2-up landscape                   enscript -2r -Phpcgb3b mydoc                         mydoc is filename of a text     
                                                                                            file; hpcgb3b is printer        
                                                                                            name. Omit  -Pprinter-          
                                                                                            name if you want to use de      
                                                                                            fault printer.                  
Print 2 copies of a file               enscript -#2 -Phpcgb3b mydoc                         mydoc is filename of a text     
                                                                                            file; hpcgb3b is printer        
                                                                                            name; #2 specifies 2 copies.    
                                                                                            Omit -Pprinter-name if you      
                                                                                            want to use default printer.    
Turn duplex off                        pslpr -Phpcgb3b -SDuplex=Off mydoc                   mydoc is the filename of a      
                                                                                            PostScript file. Duplex=On      
                                                                                            is the default for printer      
                                                                                            hpcgb3b. Same options           
                                                                                            work for enscript.              
Print from the lower paper tray        enscript -Phpcgb3b -SInputSlot=Lower mydoc           Printer hpcgb3b has two         
                                                                                            trays; the upper tray is used   
                                                                                            by default.  Same options       
                                                                                            work for pslpr.                 
Turn duplex off and print from the     enscript -Phpcgb3b -SInputSlot=Lower                 Combination of the options      
lower tray                             -SDuplex=Off mydoc                                   of two examples above.          
                                                                                            Same options work for psl       
                                                                                            pr.                             
Print duplexed pages so that they      pslpr -Phpcgb3b -SDuplex=DuplexNoTumble              -SDuplex=DuplexTumble           
must be turned over from the right     mydoc                                                specifies duplexed pages        
side                                                                                        must be turned over from        
                                                                                            the bottom of the page. my      
                                                                                            doc must be a PostScript        
                                                                                            file. Same options work for     
                                                                                            enscript.                       
Print several page ranges in a Post    pslpr -Phpcgb3b -i3-7 -i10-15 mydoc.ps               Prints pages 3 through 7 and    
Script file                                                                                 10 through 15 of file           
                                                                                             mydoc.ps on printer            
                                                                                            hpcgb3b.                        
Print PostScript file in landscape     pslpr -Phpcgb3b -L mydoc.ps                          Omit -Phpcgb3b to print on      
mode                                                                                        default printer.                
Print text file in two columns in      enscript -2r -Phpcgb3b mydoc                         Omit -Phpcgb3b to print on      
landscape mode                                                                              default printer.                
Print two collated copies of file in   qmspr -ls -#2 -c  -Pqmscgb3a my-aid-file             Specify -llanguage for the      
landscape mode on print qmscgb3a                                                            language to be used by          
                                                                                            printer to interpret the docu   
                                                                                            ment. -ls is landscape; #2      
                                                                                            requests two copies; -c asks    
                                                                                            for copies to be collated;      
                                                                                            printer to be used is qmscg     
                                                                                            b3a; file my-aid-file is a      
                                                                                            text file.                      
--------------------------------------------------------------------------------------------------------------------------

Locating and Canceling Print Jobs in the Print Queue

Locating a Print Job in the Print Queue

When you issue a print command, a copy of the file in made in the local print queue, that is, the print queue of the machine on which the print job originated. From there it is sent to the remote print server queue. The remote print server is identified by the :rm tag in file /etc/printcap and the :host tag in file /etc/qconfig for the printer on which the file is to be printed.

When issued on a Sun workstation, the command lpq displays print jobs in the local print queue; when issued on an RS/6000, the command displays jobs in the local queue and the remote print server queue. Be aware that if the printer is lightly loaded, the print job will move so quickly from the local queue to the remote server queue to the printer that by the time you issue the lpq command, the job may no longer be in the queue. The -l (long) option on the lpq command will give the name of the host on which the print job originated.

----------------------------------------------------------------------------------------------------------------------------------
$  lpq                                                query the print queue for  the default printer                                
Queue     Dev                           Status   Job  Files                                            User   PP  %  Blks  Cp  Rnk  
hpcgb3b   rlp22                         READY                                                                                       
hpcgb3b  hpcgb3b is ready and printing                                                                                              
hpcgb3b  hpcgb3b                        RUNNING  30   chap2.ps                                         ilse   0   0  217   1   0    
                                                                                                                                    
----------------------------------------------------------------------------------------------------------------------------------

Cancelling a Print Job

You can only cancel a print job that is in the local printer queue; you cannot remove it from the printer server queue. Use the lprm command with either the job number displayed by the lpq command or your userid (see examples below). If you specify your userid, all your jobs currently in the local queue will be removed. Note that you cannot remove jobs that belong to someone else.

------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$ lpr  chap2.ps                                                                                                  print file chap2.ps on the default printer               
                                                                                                                                                                          
$  lpq                                                                                                           query the print queue for  the default printer;          
                                                                                                                 the job number is 30                                     
Queue                                                               Dev                            Status   Job  Files                                             User   
hpcgb3b                                                             rlp22                          READY                                                                  
hpcgb3b                                                             hpcgb3b is ready and printing                                                                         
hpcgb3b                                                             hpcgb3b                        RUNNING  30   chap2.ps                                          ilse   
                                                                                                                                                                          
ilse@sisyphus  $ lprm 30                                                                                         remove job number 30                                     
$ lpd01: dfA030sisyphus dequeued                                                                                                                                          
lpd01: cfA030SISYPHUS.SLAC.Stanford.EDU dequeued                                                                                                                          
                                                                                                                                                                          
ilse@scssun1  $  pslpr ~ilse/phonebook-ps/chap2.ps                                                               print PostScript file ~ilse/phone                        
                                                                                                                 book-ps/chap2.ps on default printer                      
ilse@scssun1 $ lpq                                                                                               query local job queue for default printer; the           
                                                                                                                 job number is 33                                         
no entries                                                                                                                                                                
scssun1: sending to lpd01                                                                                                                                                 
Rank   Owner      Job  Files                          Total Size                                                                                                          
1st    ilse       33   standard input                 110921 bytes                                                                                                        
                                                                                                                                                                          
ilse@scssun1 $ lprm ilse                                                                                         remove all of user ilse's jobs from job queue            
dfA033scssun1 dequeued                                                                                                                                                    
cfA033scssun1 dequeued                                                                                                                                                    
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
A job that is printing cannot be cancelled with the lprm command. You may be able to stop it at the printer by taking the printer offline or pressing the reset button. You will need to check the documentation for the printer in question.

Printing Problems

Print Job Too Large

When you give a print command, a temporary copy of the print file is made in the spool area of the machine on which you are running. If there is not enough space for the file, you will receive an email message from lpd, subject: printer job, with text saying: Your printer job could not be printed. This message, as unhelpful as it is, might indicate that spool space was insufficient, especially if your file is quite large. To get around the problem, create a symbolic link to your print file from the spool space with the command:

lpr -s -Pprintername filename

No temporary copy of the file will be made; therefore......

WARNING!! Do not erase or change the file until the file has been printed.

No Output is Produced by Print Command

You've given a print command, waited for an appropriate length of time for the output to show up, but the printer output tray is empty. What to do?

1. Check that the printer is operational: Is it in print ready status? Does it have adequate paper in the input paper tray?
2. If the answer is yes, give the command:
lpq -Pprinter-name
to see if your job is sitting in the print queue of the machine on which you gave the command. (You can omit the -P option if you printed to the default printer.) If it is and the printer is operational, the print queue may need to be restarted. If you gave the print command on a Sun workstation, enter the command:
lpc restart -printername
Note: The lpc command will only work on a Sun, not an RS6000.
3. If you are printing from an RS6000 and the print queue appears to be stuck, call the SCS Help Desk at x4357. A UNIX administrator with special systems privileges will need to restart the print queue.

Need Help?

Try the following sources:


Footnotes

(1)
The examples shown in this section work on an HP Laserjet 4si mx printer. They will most likely work on other HP printers that have multiple input trays and are capable of printing duplex. The examples may not produce the same result on printers by other vendors.
 
Table of Contents Next Chapter