CHAPTER 4: HARDCOPY OUTPUT
back to the Computing Guide Contents


This chapter explains various ways to print copies of the files that you generate on MMM computers. The names and locations of the printers can be found on the Resources page. This chapter will cover the following commands.


4.1 The Unix Printing Commands


Three printer environment variables are used for the various printing commands. These variables are listed below. You should set all of these in your .login file to point to your default printer. Users should also be considerate in their use of the laser printers. Do not print out excessively large jobs during normal work hours.

LASER
Used by locally written utilities such as dotex.
PRINTER
Used by the lpr command on Berkeley Unix systems: HP Alpha and Linux.
LPDEST
Used by the lp command on System V systems: SGI and Sun.

4.1.1 The lpr Command

The lpr command is the most generic of the printing commands. While its implementation may vary, the lpr command exists on all Berkeley Unix systems. In our environment this is used on the HP Alpha architecture.
        Syntax: lpr [options] filename
If you specify a - (dash) for the file name, lpr will look for its input from standard input.

If you are using a Xerox printer, you can also use the xprint command, which is discussed later in this chapter.

The most commonly used options are:

-Pprinter       Specify printer to receive the output.
                If this is not specified, the output 
                defaults to the value of the 
                PRINTER environment variable. 

-m              Send mail to inform you of printing completion.

-s              Symbolic link. Normally, lpr copies files to the
                spooling directory of the machine where the 
                command is typed.  If -s is specified, 
                lpr will use the original file for input. 
                Thus, with this option, do not change the file
                until you finish printing. This option is for 
                printing very large files.

-#n             Specify number of copies to print.

-r              Remove the file after printing. 
                Use with the -s option.
In addition, certain flags will tell lpr that the file is "special":
-d              Presumes TeX (DVI) file.

-v              Presumes raster file.

-t              Presumes troff output file
For example, to print three copies of fish.txt on the printer peach, enter
        lpr -Ppeach -#3 fish.txt

4.1.2 The lp Command

The lp command is a generic printing command found on Unix System V systems, such as the SGI and Sun systems. Its implementation may vary on different hardware platforms.
        Syntax: lp [options] filename
The most commonly used options are
-ddest          Specify printer (dest) to receive the output. 
                If this is not specified, output will default to the 
                value of the environment variable LPDEST.

-n#             Specify number of copies to print.

-m              Send mail to inform you of printing completion.
For example, to print three copies of fish.txt on the printer peach, enter
        lp -dpeach -#3 fish.txt

4.1.3 The lpq Command

The lpq command is used to examine the status of a print job on Berkeley Unix systems.
        Syntax: lpq [-Pprinter] [-l]
When lp requests that a file be printed, this request is put in a queue. lpq allows you to check the status of one (or all) of your printing requests while they reside in the local spool directory. Note that a print job may not have actually completed printing, even though this command may not list it.

If you invoke lpq without arguments, all the print requests in the default printer's queue are reported. (The default printer is specified by $PRINTER.) If the -P option is used, the status of that printer is reported.

The output will include the request_id associated with your printing request. This id can be used to cancel this request with lprm. Additional lp options are

        -l        Display information in "long" format.

        -Pprinter Designate printer to be analyzed.

4.1.4 The lpstat Command

The lpstat command provides another way to check the printers and to display printer status information on System V Unix systems. If lpstat is used alone, it returns the status of the jobs submitted by the lp command. Arguments that are not "flags" are presumed to be request_ids, and lpstat will try to find the corresponding printing request and give its status.
        Syntax: lpstat [options]
Following are the options that can be used with lpstat.
        -t      Display all status information.

        -s      Display a basic summary of printers, including
                what the default printer is and the devices 
                associated with the various printers.

        -o      Display status of all printer requests.

4.1.5 The lprm Command

The lprm command removes a print request on a Berkeley Unix system, such as the HP Alpha workstations, while it is still in the print queue. When a print request is made, the request is put in a queue, where it is assigned a request_id. Using lprm, you can remove all requests that you have made, or specify a request_id to remove a specific job. To obtain the request_id, use lpq or lpstat.
Syntax: lprm [-Pprinter] [-][request_id] [user]
Note: lprm removes print requests from a queue.

Following is a list of lprm options.

-               Removes all requests made by that user

-Pprinter       Specifies the printer queue to examine.
As an example, to remove the request with id 13 on the printer peach, enter
        lprm -Ppeach 13

4.1.6 The cancel Command

The cancel command removes print requests on Unix System V systems such as the SGI and Sun workstations. If a request_id is given, that job is removed. If the printer is given, then all requests made by you are removed. Note that this works only while the print request is still in the spool queue, which you can check using either lpq or lpstat.
        Syntax: cancel [request_id] [printer]

On-line Information



Return to top of page

4.2 Xerox Printer Commands 

4.2.1 The xprint Command

The xprint command is used to send files to a Xerox printer.
        Syntax: xprint [options] filename

The more commonly used xprint options are:

-dprinter      Specify printer to receive the output.

-cn            Specify number of copies to print

-n             Do not display menu or graphical user interface 

4.2.2 The qpr Command

The qpr command was developed for the QMS printers, which are no longer available, but will also work in many instances for printing to the Xerox black and white printers. The qpr command can be used with a wide variety of options. For more details on these options, see the man page.
        Syntax: qpr [options] filename
The more commonly used qpr options are:
-P printer      Specify printer to receive the output.

-#n             Specify number of copies to print

-d              Print in duplex mode.

-t              Print in tumble duplex mode.

-ls             Print in landscape mode.

-p              Print in portrait mode.

-h option       Turn header page on or off for the 
                current job. Default is off.
The following example shows how to use the qpr command to print test.ps on printer peach.
        qpr -P peach test.ps
Note: The space between the -P and the printer name is required.

On-line Information



Return to top of page

4.3 Text-PostScript Conversion


4.3.1 The prtpost Command

The prtpost command is a utility to convert ASCII text files to PostScript. For most purposes, use the "in-house" commands dup80, dupf, and dup132. However, you may sometimes want to use prtpost directly; the large number of options give you great flexibility in customizing output.

The prtpost command takes a single optional argument, the source file name. If no file name is given, prtpost will read from the standard input. By default, the prtpost command writes to standard output.

        Syntax: prtpost [options] filename
The following example shows how to redirect the output to a file.
        prtpost -L -P120 -F Helvetica stuff.txt > stuff.ps
This command would process the file stuff.txt using the 12-point Helvetica font in landscape mode, and write the PostScript file, stuff.ps.

Note: Margins and points sizes are specified in decipoints; one decipoint is 1/720 of an inch. Thus, to obtain point sizes, multiply by 10. For example, -P120 was used to select the 12-point type above.

Some of the most commonly used prtpost options are:
-L        Specify landscape orientation. The default is portrait.

-N        Turn off header. The default is to print a header for
          every page.

-2        Set text in two columns. The default is one column.

-#        Select number of copies.

-P        Specify body point size (decipoints). This is the font
          size used for main body of text.

-tbydist  Specify body top margin (decipoints). The main text
          will begin printing at this distance from the bottom of
          the page. For example, to leave a top margin of 2" on
          legal size paper (8-1/2" x 14"), set tb to
          (14-2)x720 = 8640. The defaultm is page length less
          1" (720 decipoints).

-lbxdist  Specify body left margin. The main text  will begin
          printing at this distance from the left edge of the
          page. The default is 3/4" (540 decipoints).

-bbydist  Specify body bottom margin. The last line on each page
          will be printed at this distance from the bottom of the
          page. The default is 1/2" (360 decipoints).

-thydist  Specify header top margin. The page header will print at
          this distance from the bottom of the page. The default
          is page length less 1/2" (360 decipoints).

4.3.2 Bugs in prtpost

The prtpost utility recognizes the ASCII "null" character as the end of a line. Thus, an embedded null in a line will chop off the rest of the line. The more command will not show this, since the null just gets printed as part of the byte stream. However, displaying the file in Emacs will show this, since the null will appear as a nonprintable character, "^@".


On-line Information

Hardcopy Reference



Return to top of page

4.4 Other Printing Commands


4.4.1 Duplex Printing Commands (dup80, dup132, dupf)

The Xerox 5400PS laser printers, peach, banana, cherry, and fig, have the capability to output double-sided (duplex) copies. A few general utilities have been written to convert standard ASCII files to PostScript and then output them in duplex mode. By default, each page has a header that contains date and page information and will be output to the printer specified by your environment variable LASER.
        Syntax: command [options] filename
The duplexing commands available are:
dup80           Print double-sided, 80-character text. 
dup132          Print double-sided, 132-character text. 
dupf            Print FORTRAN source code double-sided, 
                two columns per page, in landscape mode.
These options can be used with the above duplexing commands.
 -N             Turn off page headers. 
 -P printer     Specify printer.

4.4.2 Printing Graphics Metacode (gpr)

Use the gpr command to print graphics metacode (gmeta) files.
        Syntax: gpr filename
This command will convert the metacode file to PostScript and send the job to the printer specified by the environment variable LASER.


4.4.3 MMM HP Color Printer

The HP Color LaserJet 4550N printer, lime, is accessible from both the Windows operating system and the Unix operating system from the DEC workstation, service14, and the Linux workstation, mimosa. The printer is located on the third floor in Cubicle 3092. If you need your Windows system set up to access lime, you need to submit an assist request. Because the queue structure for this to work in Unix is complex, a command, hpr, has been created to facilitate printing to this printer.

Syntax: hpr [-P printer] -a or -ps [-t] filename

As there is currently only one HP printer available, you do not need to specify a printer name at this time. Should we acquire Additional HP printers at a later date this option will be required. You must, however, specify either the -a (ASCII) or -ps (PostScript) option to designate your file type. The -t option is for printing transparencies

4.4.4 MMM Xerox Color Printer

The MMM Xerox color printer, bing, is available from all Windows and Unix systems. To send a job to the printer from a Unix system issue the following command

Syntax: xprint -dbing filename.ps

This will bring up a GUI interface, which will allow you to select paper size and media type.

To switch to Landscape mode, select Text File Options. You will be able to specify Portrait/Landscape modes and adjust margins.

To print in duplex mode, select the Output tab and change Simplex to Long-Edge Binding.

Once selections are made Click on the Print button.

4.5 Processing TeX Files


4.5.1 The dotex Command

The dotex command will process a file through TeX, run the device-specific driver on the output .dvi file, then print the output file. By default, printed output will be sent to the printer defined by the environment variable LASER.
        dotex [options] filename
where filename is the TeX input file. A default file type is not assumed.

Following are the options available with the dotex command:

-x              Preview file on X window device. 
-P printer      Print file on specified device.
-c           Print n copies of the file.
-p n            Start processing at specified page number. 
-l n            Last page to be processed.   
-n n            Maximum number of pages to process. 
-o filename     Send output to the specified file.
-d              Print in duplex mode. 
-t              Print in tumble duplex mode.
To process a file through TeX and print the output file on the printer specified by the environment variable LASER, enter
        dotex filename
To process the file letter.tex, and print two double-sided copies on the laser printer peach, enter
        dotex -c 2 -d -P peach letter.tex
To print only the fifth and sixth pages of the file letter.tex on the printer specified by the environment variable LASER, enter
        dotex -p 5 -n 2 letter.tex

4.5.2 Printing a TeX File in Landscape Mode

To print a TeX file in landscape mode, put the TeX command special{landscape} at the start of your TeX document instead of using the -ls print option on the printers.

4.5.3 The TeX Preview Facility

The TeX preview facility, for use with X display devices, is an efficient and useful feature that allows you to check the layout of your TeX document at your terminal. However, PostScript figures are not processed; a blank area will appear in the text in their place. Within the previewing window, there are point-and-click options for moving around in the document and displaying the finished document as it will look when printed, with the ability to zoom to four different text sizes.

To preview a TeX file, use the command:

        dotex -x filename
After you exit the preview, by clicking the quit button on the screen, the script will ask whether you want to print the document.

Viewing TeX files containing PostScript figures requires the following procedure.

1.      Enter tex filename. This produces a .dvi file.

2.      Convert the .dvi file to PostScript by entering

        dvips filename.dvi -o filename.ps

3.      You can now view the file (without PostScript figures) by entering

        xdvi filename.dvi

        and view the final document, including PostScript figures, by entering

        ghostview filename.ps

On-line Information



Return

4.6 Scanner

The division has two scanners available connected to IBM-compatible pc's. This is a Hewlett Packard Scanjet IICX scanner located in cubicle 3068 and a Umax Astra 1200s in cubicle 2058. For more information on the use of the scanner and its software, see Chapter 15.  Instructions for using the scanner are located on the table by the PC. Please enter an assist request if you have additional questions.



Return to top of page

4.7 Personal Use of Divisional Hardcopy Devices


Users may use divisional facilities such as the printers and copiers for personal use provided it does not impact NCAR related activities. There is a charge for personal use of these facilities and payment should be given to Kathy Morgan (Room 2005, ext. 8954). Inform Kathy which facility has been used so that the proper accounts can be credited.

      Charges are as follows:

      Copier              $.05/page

      Laser Printers      $.05/page


Return to top of page

Copyright © UCAR 1998 - Disclaimer - mmminfo@ncar.ucar.edu
Last Modified: 1 December 2002