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


10. Other Bells And Whistles

For special effects, if any of the macros `bop-hook', `eop-hook', `start-hook', or `end-hook' are defined in the PostScript `userdict', they will be executed at the beginning of a page, end of a page, start of the document, and end of a document, respectively.

When these macros are executed, the default PostScript coordinate system and origin is in effect. Such macros can be defined in headers added by the `-h' option or the `header=' special, and might be useful for writing, for instance, DRAFT across the entire page, or, with the aid of a shell script, dating the document. These macros are executed outside of the save/restore context of the individual pages, so it is possible for them to accumulate information, but if a document must be divided into sections because of memory constraints, such added information will be lost across section breaks.

The single argument to `bop-hook' is the sequence number of the page in the file; the first page gets zero, the second one, etc. The procedure must leave this number on the stack. None of the other hooks are (currently) given parameters, although this may change in the future.

As an example of what can be done, the following special will write a light DRAFT across each page in the document:

\special{!userdict begin /bop-hook{gsave 200 30 translate
65 rotate /Times-Roman findfont 216 scalefont setfont
0 0 moveto 0.7 setgray (DRAFT) show grestore}def end}

Note that using `bop-hook' or `eop-hook' in any way that preserves information across pages will break compliance with the Adobe document structuring conventions, so if you use any such tricks, it is recommended that you also use the `-N' option to turn off structured comments.

Several of the above tricks can be used nicely together, and it is not necessary that a `printer configuration file' be used only to set printer defaults. For instance, a `-P' file can be set up to print the date on each page; the particular configuration file will execute a command to put the date into a header file, which is then included with a `h' line in the configuration file. Multiple `-P' options can be used.


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