Creating PostScript files

Contributed by: Kristan Slack

This tip is valid for:
Both BeOS and Haiku

If you need to create PostScript files under BeOS for use with the Ghostscript viewer or for viewing in another operating system, learn to use a2ps. While a version of a2ps is included with every copy of BeOS (take a look in /bin), Kristan Slack has created a version that’s much more complete and capable.

a2ps stands for “anything to postscript.” Its role is rather obvious – it takes anything you give it, such as plain text, C++ code, or HTML, and produces a postscript output file. But a2ps is much more powerful than it first appears. a2ps can recognise many programming languages and format them with bold and italic text styles, making the final output file nice to read.

a2ps can also use “virtual pages” to reduce your final printout size – by tiling more than one “real” page on a postscript page – you can reduce the number of total pages dramatically.

A simple example

Say, for example, you’ve just written the obligatory foo.c and foo.h, and want a2ps to output a postscript file containing these. Simple:

a2ps -4 foo.c foo.h -o foo.ps

a2ps goes about it’s work, recognising these files are written in C and formatting them appropriately, tiling 4 virtual pages per actual page.

Extras

a2ps can also receive pipes from the bash shell, accept multiple files as input, change font and tab sizes, etcetera. a2ps is a powerful programmer’s tool for creating reports. For further information, a2ps has detailed help. Just type :