The print layout prolog files, mp.*.ps files, contain routines for controlling the page layout for printing. In addition to giving a header and a footer for a print page with user name, print date, and page number, these prolog files can provide other information. For example, the prolog files can give effective print area dimensions and landscape and portrait mode of printing to be used.
A set of standard functions needs to be defined in every prolog file. These functions are called when a new print page starts, print page ends, or a new column ends. The implementations of these functions define the print attributes of the printout.
The following PostScript variables are defined at runtime by the mp(1) binary. All the print layout files can use these variables for printing dynamic information such as user name, subject, print time. This information taken from the variables normally appears in the header or footer of the print page.
The name of the user who is running mp, obtained from the system passwd file.
“Listing for” - When the input is a text file
“Mail for” - When the input is a mail file
“Article from” - When the input is an article from a news group
The subject taken from the mail and news headers. You can use the '-s' option to force a subject to the mail and news files as well as to normal text files.
The time of print that appears in the header and footer. This information is taken from the localtime() function.
Following are the functions implemented in print layout prolog files. All these functions can use subfunctions.
usage : page_number endpage
Called when the bottom of a printed page is reached. This function restores the graphic context of the page and issues a “showpage.” In some prolog files the header and footer information is displayed in only a page-by-page mode rather than in a column-by-column mode. You can implement this function to call subfunctions that display the header and footer gray scale lozenges.
usage : page_number newpage
Routines or commands to be executed when a new page begins. Setting landscape print mode, saving the print graphic context, and translating the page coordinates are some of the functions for routine.
usage : page_number col_number endcol
Display header and footer information. Move to the new print position, and so forth.
For adding new print layout prolog files, you need to define the following variables explicitly within the print layout prolog file.
<number of columns in a print page>
<width of print area in inches>
<height of print area in inches>
/NumCols 2 def
/PrintWidth 6 def
/PrintHeight 9 def