[Next] [Previous] [Up] [Top] [Contents] [Index]
Chapter 8: Printing
a2ps and psnup, described below, are now in the UPS product psutils. You may need to run setup psutils before using them. They can be used from the UNIX command line as well as from many applications. pr is also available to format the pages before printing with flpr. pr is explained in the man pages.
a2ps and psnup are described in detail in the man pages and in the Fermilab DCD Release Note 41.0 Users Guide to UNIX Printing Utilities.
The a2ps utility converts ASCII to two-column PostScript by default, and encloses the text in boxes with headers indicating date, time, filename and page number. You also get a line saying "Printed by username from node". You can override the defaults; see the man pages.
a2ps is useful if the printer can only accept PostScript. You can use it to produce different output formats (e.g., "2-up", where two pages of your file are shrunk to fit on a single sheet). It provides options to add items like line numbers, user, file, and system information to the output. The command syntax is:
% a2ps [global options] files [positional options] files
where global options apply to all files being printed, and positional options are applied only to the files found in the remainder of the command line (with the exception of -H as noted in the man page which only applies to the next file).
Here is an example where we pipe the output of a2ps to flpr (-p indicates portrait mode):
% a2ps -p file1 | flpr -q wh10w_lw
The psnup utility takes a PostScript file and prints it "n-up". This refers to how many pages get printed on a single sheet. Portrait and landscape mode alternate as n changes. Occasionally this procedure doesn't work due to problems with PostScript variance.[39] The syntax of the command is:
% psnup [-pn] [-r] [-R] [-sn] files
where:
-pn the number of pages of PostScript (or spots) that should be printed per sheet of paper. n is constrained to be 2, 4, 8, 16, 32, or 64.
-r sets the first spot in lower right and progresses horizontally to the upper left. This is handy for when the pages have already been reversed by another program, and you are printing on a printer that reverses pages.
-R sets the first spot in the upper left hand corner and progresses horizontally to the lower right. This is for non-reversing printers.
-sn n is the number of the spot you want the first page of output to be placed. The first spot on the page is 0, not 1.
Duplex mode refers to printing on both sides of the paper. This is often desirable for larger documents, although not all printers support this feature.
To print a PostScript file in duplex mode on a printer that supports this feature, you must prepend some specific text to the file. An easy way to do this is to maintain this text in a separate file, and concatenate it to your PostScript file when you are ready to print it in duplex mode. The two-line text file, which we'll call duplexps here, must have the following contents:
|
To print your PostScript file in duplex mode, enter the command:
% cat duplexps postscript_file | flpr -qduplex_printer
For text files, you need to prepend a different sequence to the file. The technique we present here works with any PCL-based printer with a duplex device in it (assuming no filters are in the way) . Since text files are easy to edit, just add the following line to the top of your file[40]:
|
The trick is to get the escape character in your file! The sequence <Ctrl-[> will work for escape, but it must be preceded by a "quoting" character, which differs from editor to editor.
... enter:
<Ctrl-v> <Ctrl-[>
<Ctrl-q> <Ctrl-[>
<Ctrl-v> <Ctrl-v> <Ctrl-[> <Ctrl-[>
<Ctrl-[> <Ctrl-[>
Use Insert Control Character from the Edit menu; escape is 27 decimal. The escape character may not echo on your screen depending on your font.
... to insert an escape character. Then print the file in the usual manner to an appropriate printer.