a2ps (Anything to PS) is a program that converts files to PostScript, the language used for graphics and understood by many printers, especially laser printers. You might want to use a2ps for example to print "text files" (like email) in both sides of the paper in a printer with duplex option. Or you can also use it to print "two pages in one," that is, reduce the size of each page by 50% and print two of them in one single sheet of paper.
Without any options you can use the command like this:
This will convert the file file-name into a PS file; the output will come to the terminal, which is not very useful unless you can either save it or process it further. To save the output in a file you can do the following:
To print the file directly (in a printer that understands PS) you could do this:
(I have not explained yet the lpr command; I will do it in a future post).
The above option (sending the file to a printer) can be done with an option of a2ps as follows:
There are many different options for a2ps. Here are some useful ones.
- -r to print in landscape mode, -R in portrait mode
- -1, -2,…, -9 to have 1, 2,…, 9 pages printed in a single sheet of paper (I find -2 and -4 the most useful options).
- -j to print borders around columns, –borders=no for no borders
- -B (or –no-header) for no header information (which usually contains the file name, user, date and things like that, printed at the top of the pages).
- –font-size=SIZE to use fonts of certain SIZE
- -L NUM to scale fonts to print NUM of lines per page
- -l NUM to scale fonts to print NUM of colums per page
- -b TEXT to put TEXT as the header of the pages
- –left-title TITLE and –right-title TITLE to set titles at the left and right ends of the pages
- -c or –truncate-lines=no to cut or not long lines
- -i or –interpret=no to understand TABS or not
- –print-anyway=yes or –print-anyway=no to force or not binary printing
- -P printer-name to send output directly to the printer (via the printing program of your machine)
- -n NUM to print NUM of copies of each page
You can look at the manual page for more information. I use a2ps in two different ways:
to print with and without headers respetively, "two pages in one" in landscape mode.