Go to the first, previous, next, last section, table of contents.

9 Contributions

This chapter documents the various shell scripts or other tools that are distributed with the a2ps package, but are not a2ps itself. The reader shoould also look at the documentation of Ogonkify (see section `Overview' in Ogonkify manual), written by Juliusz Chroboczek.

9.1 a2ps Emacs mode

FIXME: Document me.

9.2 card

Many users of a2ps have asked for a reference card, presenting a summary of the options. In fact, something closely related to the output of `a2ps --help'.

The first version of this reference card was a PreScript file (see section 7.3.2 PreScript) to be printed by a2ps. Very soon a much better scheme was found: using a style sheet to pretty print directly the output of `a2ps --help'! A first advantage is then that the reference cards can be printed in the tongue you choose.

A second was that this treatment could be applied to any application supporting a `--help'-like option.

9.2.1 Invoking card

card [options] applications

card is a shell script which tries to guess how to get your applications' help message (typically by the options `--help' or `-h'), and pretty prints it thanks to a2ps (or the content of the environment variable `A2PS' if it is set).

Supported options are:

Option: -h
Option: --help
print a short help message and exit successfully.

Option: -V
Option: --version
report the version and exit successfully.

Option: -D
Option: --debug
enter in debug mode.

Option: -l language
Option: --language=language
specify the language in which the reference card should be printed. language should be the symbol used by LC_ALL etc. (such as `fr', `it' etc.).

If the applications don't support internationalization, English will be used.

Option: --command=command
Don't try to guess the applications' way to report their help message, but rather use the call command. A typical example is
card --command="cc -flags"

Any option that is not recognized by card is passed to a2ps (see section 3.1 Command line options). Be aware that these options must not be separated from their arguments. For instance

card gmake gtar --command="cc -flags" -Pdisplay

builds the reference card of GNU make, GNU tar (automatic detection of `--help' support), and cc thanks to `-flags'. Since `-P' is not supported by card, it is passed to a2ps.

9.2.2 Caution when Using card

Remember that card runs the programs you give it, and the commands you supplied. Hence if there is a silly programs that has a weird behavior given the option `-h' etc., beware of the result.

It is even more clear using `--command': avoid running `card --command="rm -rf *"', because the result will be exactly what you think it will be!

9.3 fixps

The shell script fixps tries its best to fix common problems in PostScript files that may prevent post processing. It makes heavy use of the psutils. It is a good idea to use fixps upstream in the PostScript to PostScript delegations.

9.3.1 Invoking fixps

fixps tries to make simple fixes, but some really broken files may require much deeper treatment. If fixps feels the need for such a major surgery act, it may give up local changes and ask Ghostscript for a global rewriting.

fixps [options] [file]

sanitize the PostScript file (or of the standard input if no file is given, or if file is `-').

Supported options are:

Option: -h
Option: --help
Print a short help message and a list of the fixes that are performed. Exit successfully.

Option: -V
Option: --version
report the version and exit successfully.

Option: -D
Option: --debug
enter in debug mode.

Option: -o file
Option: --output=file
specify the file in which is saved the output.

Option: -f
Option: --force
Ask ghoscript for a full rewrite of the file. The output file is really sane, but can be much longer than the original. For this reason and others, it is not always a good idea to make a full rewrite. This option should be used only for files that give major problems.

9.4 fixnt

fixnt (see its http://www.itsm.uni-stuttgart.de/~bauer/fixnt.html, home page) is maintained by Holger Bauer and Michael Rath. It is meant to fix the problems of the PostScript files generated by the Microsoft PostScript driver under Windows NT (3.5 and 4.0).

fixps is aware of the cases where fixnt should be used, hence you should not worry of when to use fixnt.

9.4.1 Invoking fixnt

fixnt < `file.ps'

sanitize the PostScript file file.ps and produce the result on the standard output.

9.5 pdiff

The shell script pdiff aims to pretty print diff between files. It basically uses GNU diff (see section `Overview' in Comparing and Merging Files) or GNU wdiff (see section `The word difference finder' in GNU wdiff) to extract the diff, then calls a2ps with the correct settings to get a nice, printed contextual diff.

9.5.1 Invoking pdiff

pdiff [options] file-1 file-2

make a pretty comparison between file-1 and file-2.

Supported options are:

Option: -h
Option: --help
print a short help message and exit successfully.

Option: -V
Option: --version
report the version and exit successfully.

Option: -D
Option: --debug
enter in debug mode.

Option: -w
Option: --words
Look for words differences (default). White space differences are not considered.

Option: -l
Option: --lines
Look for lines differences.

Any option that is not recognized by pdiff is passed to a2ps (see section 3 Invoking a2ps). Be aware that these options must not be separated from their arguments. For instance

pdiff -l -Pdisplay COPYING COPYING.LIB

Compares the files `COPYING' and `COPYING.LIB', and prints it on the printer display (usually Ghostview or gv). Since `-P' is not supported by pdiff, it is passed to a2ps.

9.6 psmandup

I personally hate to print documents of hundreds of pages on a single sided printer. Too bad, here there are no Duplex printers. The idea is then simply first to print the odd pages, then the even in reversed order. To make sure one flips the page in the meanwhile, the second half should be printed from the manual feed tray.

Make a shell script that automates this, and you get psmandup.

9.6.1 Invoking psmandup

psmandup [options] [file]

produce a manual duplex version of the PostScript file (or of the standard input if no file is given, or if file is `-'). Once the first half is printed, put the sheet stack in the manual feed tray for the second half(5).

Be aware that there is a time out for manually fed jobs, usually short, hence do not miss the moment when the printer asks for the stack. If ever you missed that moment, see option `--back' to recover the second half.

Supported options are:

Option: -h
Option: --help
print a short help message and exit successfully.

Option: -V
Option: --version
report the version and exit successfully.

Option: -D
Option: --debug
enter in debug mode.

Option: -o file
Option: --output=file
specify the file in which is saved the output.

Option: -n
Option: --no-fix
psmandup will fail on ill designed PostScript. Actually it is the psutils that fail. To avoid this, by default the PostScript file is sanitized by fixps.

When given this option, don't run fixps. This is meant to be used when fixps has already been used higher in the processing chain.

Option: -f
Option: --front
Output only the front pages, with no special PostScript feature request.

Option: -b
Option: --back
Output only the back pages, with a manual feed request.

This option is especially useful when the manual feed time out expired before you could insert back the stack in the manual feed tray.

psmandup assumes the printer is Level 2, and supports manual feeding. The file should be reasonably sane, otherwise psmandup fails miserably.

Typical use is

psmandup file.ps | lp

or can be put into a2ps' printer commands (see section 4.5 Your Printers).

9.7 psset

The shell script psset inserts calls to setpagedevice in a PostScript file. This is useful for instance to add Tumble or Manual feed request. Actually, psmandup uses psset.

You should know nevertheless that a2ps is able to make the calls to setpagedevice by itself, i.e., you can run `a2ps -SManualFeed foo' to print `foo' onto the manually fed tray, or run `a2ps -s2 foo' to print Duplex. There are no need of psset from a2ps.

9.7.1 Invoking psset

psset [options] [file]

produce a version of the PostScript file (or of the standard input if no file is given, or if file is `-') that makes protected calls to the PostScript operator setpagedevice. Typical use is making file print duplex, or on the manual tray etc.

The call is protected so that the resulting file is safe, i.e., will still be portable, even with requests such as `-Sfoo:bar'.

It is safe to run psset with no feature requests. Depending upon the option `--no-fix', it is either equivalent to doing nothing, or to running fixps (see section 9.3 fixps).

Supported options are:

Option: -h
Option: --help
print a short help message and exit successfully.

Option: -V
Option: --version
report the version and exit successfully.

Option: -D
Option: --debug
enter in debug mode.

Option: -o file
Option: --output=file
specify the file in which is saved the output.

Option: -n
Option: --no-fix
psset will fail on ill designed PostScript. Actually it is the psutils that fail. To avoid this, by default the PostScript file is sanitized by fixps.

When given this option, don't run fixps. This is meant to be used when fixps has already been used higher in the processing chain.

Option: -S key:value
Option: --setpagedevice=key:value
Insert a setpagedevice call setting key to value. Multiple values accumulate. Lists of requests separated with `;' are valid (e.g., `-SDuplex:true;Tumble:false').

Option: -a page
Option: --at=page
Specify the page where the setpagedevice call should be done. The page 0, which is the default, corresponds to the beginning of the `Setup' section in the document. In a typical use you should not change the page.

Option: -m
Option: --manualfeed
Alias for `-SManualFeed:true', i.e., the request to print using the manual feed tray.

Option: -d
Option: --duplex
Alias for `-SDuplex:true;Tumble:false', i.e., the request to print in duplex mode, binding along the long edge of the paper.

Option: -t
Option: --tumble
Alias for `-SDuplex:true;Tumble:true', i.e., duplex printing such that binding should happen on the short edge of the medium.

Go to the first, previous, next, last section, table of contents.