Pretty Printing of ACII Text Files

There are programs on our unix and linux machines which will convert a plain text file to postscript and send it to a postscript printer. But they will also format the content in multiple columns or a font size of your choosing, and even request it be printed in duplex mode (front and back of paper) if the printer is duplex-capable. In fact there are a huge number of options available which you can peruse by looking at the man pages for the program.  Also very helpfull is the ability not to send the postscript output to a printer. Instead you can save it as a file with the '.ps' extention, or you can pipe it into a postcript viewer where you can inspect output to see if it is to your liking before sending to a printer.

First, on linux boxes, the command is called a2ps. Here is a sample command line:

    a2ps -R --columns=1  -f8 -P metr1201 textfile

Here, we are requesting Portrait mode (-R), one column(--columns=1), 8 pt font size (-f8), and printing on the metr1201 printer (-P metr1201).

If we want to view it with a postscript viewer instead of sending to a printer:

    a2ps -R --columns=1  -f8 -o - textfile | kghostview -

where '-o -' sends the postscript output to standard out, and we pipe ('|') it to the Konqueror ghostview program, kghostview.  kghostview needs the trailing '-' to tell it that it's input is not a file but is coming through a pipe from the previous command. You can re-run this command line with various options to examine their effect. Then you can print directly from kghostview if you like the look of it, or you can re-run the a2ps command with your options and save the output to a file (-o filename.ps) which you can then send to the printer.

The default action for a2ps is to format the text into 2 columns, reduce the font size automatically to a size appropriate for that column space, and to display in landscape mode. Most folks like to use this to print their fortran or c program files because it gets more on the page and waists less paper. See what you get if you run:

    a2ps -o - textfile | kghostview -

If you are sending to a duplex-capable printer (printing on front and back of a page), then use '-s2' to specifically request duplex printing.

Please see the man pages for a2ps and look over the available options.
An excellent web site for a2ps is
               http://www.infres.enst.fr/~demaille/a2ps/doc-4.12/a2ps_toc.html


On most of our SGI machines, comparable programs are
    /usr/sbin/imprint
    /usr/freeware/bin/enscript
Check the man pages for their usage. They are slightly different from a2ps.
    Postscript viewers are xv and xpsview, aka showps.

On Sun workstations, the comparable program is nenscript.
    Postscript viewer is xv.