(v13) Adding to the page
This page applies to Harlequin v13.1r0 and later; both Harlequin Core and Harlequin MultiRIP.
As well as changing the coordinate system, you can use the BeginPage
and EndPage
procedures to do other tasks between pages. For example, you can add annotations, change screens, and so on.
However, there are two limitations you are likely to encounter:
EndPage
procedures require a call toinitgraphics
in order to produce reliable results when adding marks to the page, whether or not doing imposition, because the job does not leave the coordinate system in a known state.- Anything done in
BeginPage
is likely to be restored away immediately afterwards for most jobs, as illustrated in the section on (v13) The Imposition page device key, unless global memory is used. Unfortunately, this means that changes to the graphics state cannot be made to persist, except for the current matrix, which is handled specially, as described in that section.
Annotation might be added to ordinary pages or imposed output pages.
In the first case, this is simply a matter of doing the drawing required, most often in the EndPage
procedure set up in a call to setpagedevice
(because of the PostScript language’s opaque painting model, the job itself usually obliterates some or all of the graphics done in a BeginPage
). A BeginPage
procedure is called at the start of each page, and EndPage
just before the page is output.
The following example puts the word "DRAFT” in outline across each page before it prints it, working out the angle to print at and so on from the page size.
/SW-Font /Times-Roman def
<<
/EndPage { % showpagecount code exch pop
2 ne dup { % not on deactivation gsave
initgraphics
//SW-Font 100 selectfont currentpagedevice /PageSize get aload pop
0 0 moveto(DRAFT) true charpath flattenpath pathbbox newpath
3 -1 roll sub
3 1 roll exch sub exch 4 2 roll
2 copy exch 2 div exch 2 div translate
2 copy 2 copy lt { exch } if pop
4 index div
0.7 mul dup scale exch atan rotate
exch neg 2 div exch neg 2 div translate
0 setgray
0 0 moveto (DRAFT) false charpath stroke grestore
} if
} bind
>> setpagedevice
When imposition takes place, the interaction between the imposition and the annotation must be considered. For example, if you want “DRAFT” as above, should it print once per input page or once per output page?
Also, it may be appropriate to do some graphics in BeginPage
when imposing pages. For example, you might want labels of various kinds outside the area of any of the job’s pages. This is especially true of pre-separated color jobs (color jobs automatically separated by the Harlequin RIP are quite different, and this is the subject of (v13) Color separation). To the Harlequin RIP, pre-separated jobs appear just like any other set of pages, except that it is now possible to determine the color of the separation; see (v13) Using DCS with pre-separated pages. Graphics in BeginPage
may be used to add crop marks, color bars, registration marks and so on, either once per layout or once per input page as required. The calculations to position these, especially if you are automatically packing the output media, can be quite complex, but are not otherwise unusual, so [RB2] provides the necessary information. Clearly graphics to lie outside the input page area must be inserted before the clipping to that area.