CCIT

UA Home CCIT Home UA Search

CCIT Printing

Revised Jan 27 2004
Electronic Reserve and JSTOR documents may not be printed on CCIT printers.

CCIT's high-speed laser printers are capable of processing plain text, formatted text and graphics (PostScript). Although these laser printers are shared by and accessible to the MVS system, this page documents their use from the U-System and Super. The "print queues" described in this document only have relevance in a Unix-type environment. The same or comparable commands apply to Linux.  Generally, Unix-type systems print with the commands lpr, lp, a2ps and enscript, which have the form

    lpr  -Pxxx  filename

where xxx is the name of a queue ("logical printer") and filename is the file you wish to print.  All of these printing systems and techniques are described in this webpage.


Computer labs that use CCIT's Print Server for print routing to their remote printers must now use the rlpr command:      rlpr -Pqueue -Hhostname file with hostname being the name of their printer and queue being the name of the print queue on it.  There are examples of rlpr below.


When a print queue is not specified with any of the commands, the default queue will be used. Whether you are printing on U-System or Super, the default queue is "nohole" and default printing is
        2-sided, 1-up, no-hole paper, portrait orientation
There are several ways and many options for overriding printing defaults.  Because some queue names no longer exist or were renamed, verify that your environment variables and scripts use the new names.  One way to override the default queue is by creating the LPDEST environment variable with the name of your preferred queue, e.g., "3hole", but you can also override the default print queue in your print request with the option –P.

   lpr filename             --> uses the default "nohole" queue
   a2ps –P3hole PSfilename  --> overrides the default queue
                                to print on 3-hole paper
   enscript –U4 filename    --> uses the default "nohole" queue
                                but overrides the default 1-up
                                setting and prints 4-up

For details on all print commands refer to the manpages or jump to the descriptions in this webpage using the links below.  Note that lpr and a2ps are able to print both text and PostScript without any special options on your part.

   TEXT Printing     POSTSCRIPT Printing
    lpr               lpr
    a2ps              a2ps
    enscript

To list the names of local print queues available on your system, one or more of the following should work:

   lpstat -a
   lpq –Pqueuename
   lpq   (lpq alone shows the default queue on some systems
          but all queues on others )
   lpc show all     (on Super)
   more printcap    (on Super)
   more /etc/printers.conf  (on Suns)

Print Queues

Queue    #sides  #up   orientation
nohole    2       1     portrait default
3hole     2       1     portrait


Printing Text

This section describes how to print a text file using a2ps, enscript and lpr. See Printing PostScript if your file has graphics or contains PostScript.  You can jump to the Examples if you only need a reminder or use the Pictoral Commands graphic to find a command that will produce output that looks a certain way.

Equivalents of Old U-Cluster Print Queues and Commands

  
Old Queue/Command   #Sides  #Up    Equivalent 2ps/enscript/lpr command

  ps/dup             2       1      a2ps (or enscript or lpr)  file
  dup3hole           2       1      a2ps (or enscript or lpr) -P3hole file
  2dup_b             2       2      a2ps  -2  --borders=on  file
  ps1s/simp          1       1      a2ps  -=simplex  file (nohole only)
  ps_b/dup_b         2       1      a2ps  --borders=on  file
  2dup               2       2      a2ps  -2 file
  prtx -2up          2       2      a2ps  --rows=2 -L62 file
  prtland            2       1      a2ps  -r -l132 (minus, lowercase "L", 132)
  prtport            2       1      a2ps  (or enscript or lpr)  file
   

Note that a2ps and enscript automatically rotate (landscape) a file for 2-up; 4-up is portrait.  Many options have the same names for a2ps and enscript.  Where the option is different between the two, both techniques are given in the documentation below.

 


A2PS / ENSCRIPT

The a2ps and enscript utilities can be used to print text files which the software will then turn into PostScript based on the formatting directives you provide in your request and those provided with the system defaults.  For a full list of options see "man a2ps" and "man enscript".  The options and examples here are only a small subset and just the ones that would satisfy the majority of CCIT’s printing requirements.  The input parameters allowed with a2ps are generally the same ones permitted with enscript so the options are described together for both commands below, however, a2ps can print both text and PostScript files.

(The options which were introduced with GNU's original version of enscript, genscript, are prefixed with double-dashes (--).  They are more intuitive and easier to remember (but longer) than the older and cryptic versions but work the same.  The enscript that executes on all of our systems is the latest GNU version.)

Along with the manpages, there is also helpful information obtained with

   a2ps --help  for a terse display of input options
   a2ps --list-options  for a display of system defaults
   a2ps --list=prologues  for a list of a2ps fonts
   enscript --help  for a terse display of input options
   enscript --list-options  for a display of system defaults

A2PS and ENSCRIPT Options

-b'header' or --header='header'  to place a special heading at the top of each logical page.  If printing 2-up, both pages will have this heading.  The default is to use the file name as the header.

-D used to print simplex with enscript (see -=simplex for a2ps).  The default is -DDuplex:true so, to print simplex, make this flag false:  -DDuplex:false.

-ffontname or --font=fontname to print under enscript using a font other than the Courier size 10 default. (See --prologue for a2ps.)  The printer knows about most of the Adobe PostScript fonts, but enscript does not.  When your print request contains a font unknown to the enscript library, you will get the message "couldn't open AFM for font ___, using default."  The metafile with font information is missing on the server but it sends the request to the printer anyway, and the font will be loaded at print time.  To request the font size, (like 8, 10, 14, etc.) append the font-size number to the font name.  The font size must be present; there is no default.  These names are case-sensitive.

This is only a partial list of the 100+ available fonts. 

  • Courier10 is the default on our system
  • Arialn
  • Bookman-Lightn
  • Helvetican
  • Palatino-Romann
  • Times-Romann

-b'header' or --header='header'  for a2ps to place a special heading at the top of each logical page.  If printing 2-up, both pages will have this heading.  The default is to use the file name as the header.

-B for a2ps allows you to turn off page headers.

-ffontsize or --font-size=# is used to set the font size for a2ps.  See --prologue for setting the font itself for a2ps.

-j or --borders  (use --borders for a2ps) places a border around each logical page, whether printing portrait, landscape, 2-up, etc.

-l (lower-case “L”) or --chars-per-line=# is the a2ps option that controls the width of a print page (and, therefore, the size of the font used).  Use  -l 132 to print 132 characters-wide output in portrait layout.

-L or –lines-per-page=# is the a2ps option that controls the length of a print page (and, therefore, the size of the font used). 

-Pprinter or --printer=printer or -dprinter  used to specify the print queue:

  • nohole is the default--one-up, portrait, duplex on no-hole paper
  • 3hole is one-up, portrait, duplex on 3-hole paper
  • There are some special queues available with a2ps

--prologue=fontname is used to set the font name for a2ps.  A partial font-name list is above under -ffontname.  With a2ps, as with enscript, the font-name parameter is case-sensitive.  With a2ps the font size is specified using -ffontsize.

-r or --landscape used to rotate the orientation of the page from the default of portrait.  When you specify 2-up printing, the output is automatically rotated to landscape; when you specify 4-up, it is printed in portrait.

 --rows=2 is the a2ps option that allows you to align two logical pages vertically on a portrait page (versus 2-up which is side-by-side).

-=simplex or -=s1 is used with a2ps as a flag to override the duplexing default.  (The “minus equal” prefix is for special user options.) Simplexing does not work with 3-hole paper.

-U# or --nup=# or -#  sets the logical number of pages per physical page for enscript; use -# with a2ps.  See -r above.


LPR for Text

The lpr command is native to Unix and can be used to print text and PostScript.  The description for PostScript is later in this webpage.

LPR Options

-P  The print queue name is specified with the -P option.

  • nohole is the default--one-up, portrait, duplex, on no-hole paper
  • 3hole is one-up, portrait, duplex, on 3-hole paper

-J  The Job option is used to control output disposition and what prints on the banner page.  Its input should be contained in quotations if it contains blanks.  If not specified, the name of the file being printed is used as the job name.

The options listed below can be passed using the -J parameter and must conform to the following rules:

  • The options are in the form of KEYWORD=value pairs.
  • The options are not order-dependent following the "-J".
  • The KEYWORD must be in capital letters.
  • The value may be in mixed case but there can be no embedded spaces.
  • The options must be separated by commas with no intervening spaces.

DIST=STnn  This controls where output is placed. The default Distribution Station is 00 which is the public shelves of CCIT's I/O Window.  The only way to override this Distribution default is by using lpr with this "J-switch".

USER=.... This can be used for a description of you or your job name. It may be lowercase but spaces may not be embedded. If not specified, it defaults to your userid on the system from which you are printing. This controls in what alphabetic bin within Distribution Station (DIST option, above) your output is filed.


Printing PostScript

The commands and examples in this section are used to print PostScript (used here to refer to files containing graphics also).  See Printing Text if the file you want to print is plain text.  You can jump to the Examples if you only need a reminder or use the Pictoral Commands graphic to find a command that will produce output that looks a certain way.

Before you actually print a PostScript file, you might want to preview it using ghostscript or ghostview.  Both of these utilities are present on U-System and Super, and have manpages.  This free software allows you to view and print PostScript files on printers without the PostScript driver software. Look here for Ghostscript information, documentation and links.

Both lpr and a2ps can print PostScript without any special user input parameters or queues.  A PostScript file normally has formatting commands, like font, embedded in it and neither of these commands has the ability to override such internal directives.


LPR for PostScript

This lpr command has fewer options on the U-System than on its predecessor, the U-Cluster.  It can be used for printing text files OR files that already contain print formatting, like PostScript files.  If your PostScript file needs to be further formatted, such as printing it 2-up, see the a2ps utility below.

LPR Options

-P  The print queue name is specified with the -P option.

  • nohole is the default--one-up, portrait, duplex on no-hole paper
  • 3hole is one-up, portrait, duplex on 3-hole paper

-J  The Job option is used to control output disposition and what prints on the banner page.  Its input should be contained in quotations if it contains blanks.  If not specified, the name of the file being printed is used as the job name.

The options listed below can be passed using the -J parameter and must conform to the following rules:

  • The options are in the form of KEYWORD=value pairs.
  • The options are not order-dependent following the "-J". The KEYWORD must be in capital letters.
  • The value may be in mixed case but there can be no embedded spaces.
  • The options must be separated by commas with no intervening spaces.

DIST=STnn  This controls where output is placed. The default Distribution Station is 00 which is the public shelves of CCIT's I/O Window. The only way to override this Distribution default is by using lpr with this "J-switch".

USER=.... This can be used for a description of you or your job name. It may be lowercase but spaces may not be embedded. If not specified, it defaults to your userid on the system from which you are printing. This controls in what alphabetic bin within Distribution Station (DIST option, above) your output is filed.

A2PS

The a2ps utility should be used to further refine or override the printing controls within a file that is already PostScript.  For a full list of a2ps options see "man a2ps".  The options and examples here are only a small subset and just the ones that would satisfy the majority of CCIT's printing requirements. 

Along with "man a2ps", there is also helpful information obtained with

   a2ps --help  for a terse display of input options
   a2ps --list-options  for a display of system defaults

A2PS Equivalent of Old U-Cluster Print Queues

Old Queue  #Sides #Up  Equivalent a2ps command
ps/dup      2     1     a2ps file
                        (duplex, portrait, 1-up are defaults)
dup3hole    2     1     a2ps -P3hole file
2dup_b      2     2     a2ps --landscape -–borders=on –2 file
ps1s/simp   1     1     a2ps -=simplex file
ps_b/dup_b  2     1     a2ps --borders=on
2dup        2     2     a2ps --landscape -2

 


A2PS Options

--borders or –j flag used to place a border around each column. 

-Pprinter or --printer=printer used to specify the print queue:

  • nohole is the default--one-up, portrait, duplex on no-hole paper
  • 3hole is one-up, portrait, duplex on 3-hole paper
  • There are some special queues available with a2ps

-=simplex or -=s1 is used with a2ps as a flag to override the duplexing default.  (The “minus equal” prefix is for special user options.) Simplexing does not work with 3-hole paper.

-# sets the logical number of pages per physical page. 


Printing Examples - Text

lpr  filex
    Prints a text file on nohole paper, one-up, duplex, portrait.
a2ps  -P3hole  filex
    Prints filex on 3-hole paper, one-up, duplex, portrait.
a2ps  -2 --borders=on  -b'special heading'  filex
    Prints filex 2-up, duplex, landscape with a
    border and page heading.
enscript  --landscape -DDuplex:false  filex
    Prints filex 1-sided, landscape.
a2ps  --landscape  –l 132  -=simplex  filex
    Prints simplex like the above enscript example.
    (The line-length setting (-l) is needed with a2ps in
    the event that filex contains lines longer than 132.)
enscript  -fPalatino-Roman8  filex
    Prints on no-hole paper, one-up, duplex, portrait,
    using this size-8 font.
a2ps  -4 --borders=on  filex filey filez
    Prints these 3 files together as one job;
    4-up, 2-sided, portrait with a border.
a2ps -Ppdf script
    Makes a PDF called script.pdf from the file script.
rlpr  -Praw@hp201.ag.arizona.edu  filex
    Prints to the raw queue of a fictional printer named hp201.
man vi | col -bx | a2ps –2 –P3hole
    Prints the vi manpage 2up (man output contains control characters
    so the man output is pre-processed by col before printing).


Printing Examples - PostScript

lpr  filex
    If filex is PostScript, prints it according to the PostScript
    directives.
lpr -JDIST=ST09  henway.ps
    Prints the file with Distribution Station=9 on the banner page.
a2ps -2 --borders=on  r235.ps  r236.ps
    Prints the 2 PostScript files together in one print job; 2-up, 
    landscape with a border, duplex on no-hole paper, regardless 
    of the files’ internal printing controls.
a2ps -Ppdf instr.ps; cp instr.pdf public_html; chmod a+r instr.pdf
    Takes the file instr.ps and creates a PDF named instr.pdf; 
    copies the PDF to the directory public_html; makes the PDF
    universally readable.
rlpr  -Praw -Hhp201.ag.arizona.edu  filex
    Prints to the raw queue of a fictional printer named hp201.
man ssh | col -bx |  a2ps –4 
    Prints the manpage for ssh 4up on the default print queue (nohole).
zcat psfile.ps.Z | a2ps –2 –P3hole
    Prints the compressed PS file 2-up on 3-hole paper.

See the manpages for lpr, lr, enscript, and a2ps, for complete formatting options.  See man printing for a collection of examples on U-System and see "hottip printing" for thumbnail help.  There are manpages for the utilities mpage and psnup which are useful for placing multiple pages on a printed sheet ("n-upping" your output) and ps2ps is a utility for cleaning up PostScript.


Terminal Site Queues

"Public" printers are located throughout campus.  If you're computing on U-System and want to print to a more local printer (one remote to CCIT), you must use the rlpr command:    rlpr -Pqueue -Hhostname file with hostname being the name of their printer and queue being the name of the print queue on it.


Using a Printer Attached to Your Terminal

Some terminals and terminal emulation software will allow you to print a file on a locally attached printer. Type "man vtprint" for instructions.


Printing Information
UA Homepage      CCIT Homepage


The Center for Computing & Information Technology (CCIT)
CCIT Knowledgebase
Telephone: 621-HELP
Email: Consult@listserv.arizona.edu

Website maintained by:
CCIT Computing Services