Next: , Up: How to print   [Contents][Index]


2.2.1 Basics for Printing

Say you want to print the C file bar.c, and its header foo.h, on 4 virtual pages, and save it into the file foobar.ps. Just hit:

gargantua $ a2ps foo.h bar.c -4 -o foobar.ps
[foo.h (C): 1 page on 1 sheet]
[bar.c (C): 3 pages on 1 sheet]
[Total: 4 pages on 2 sheets] saved into the file `foobar.ps'

The option ‘-4’ tells a2ps to make four virtual pages: two rows by two columns. The option ‘-o foobar.ps’ (which is the short version of ‘--output=foobar.ps’) specifies the output file. Long options must always be separated by spaces, though short options with no arguments may be grouped.

Note too that the options may be specified before or after the files, it does not matter.

If you send foobar.ps to a printer, you’ll discover that the keywords were highlighted, that the strings and comments have a different face. Indeed, a2ps is a pretty-printer: if it knows the (programming) language in which your file is written, it will try to make it look nice and clear on the paper.

But too bad: foo.h is only one virtual page long, and bar.c takes three. Moreover, the comments are essential in those files. And even worse: the system’s default printer is out of ink. Thanks god, precious options may help you:

gargantua $ a2ps -4 -Av foo.h bar.c --prologue=gray -P lw
[foo.h (C): 1 page on 1 sheet]
[bar.c (C): 3 pages on 1 sheet]
[Total: 4 pages on 1 sheet] sent to the printer `lw'

Here the option ‘-A’ is a short cut for the option ‘--file-align’ which specifies how different files should be separated. This option allows several symbolic arguments: ‘virtual’, ‘rank’, ‘page’, ‘sheet’ (See Sheet Options, for more details). The value ‘virtual’ means not to start each file on a different virtual pages.

So to fill the page is asked by ‘--file-align=virtual’, or ‘-A virtual’. But symbolic arguments can be abbreviated when there are no ambiguity, so here, you can just use ‘-Av’.

The option ‘-P lw’ means to print on the printer named ‘lw’, and finally, the long option ‘--prologue’ requires the use one of the alternative printing styles. There are other prologues (See Input Options, option ‘--prologue’), and you can even design yours (see Designing PostScript Prologues).


Next: Special Printers, Up: How to print   [Contents][Index]