Skip to main content
Skip table of contents

Hooks



This page applies to Harlequin v13.1r0 and later; both Harlequin Core and Harlequin MultiRIP.

Certain keys in the page device, documented below, have values that are procedures or reference procedures. These hooks are used to change the behavior of jobs when they use setpagedevice.

Most hooks need to call currentpagedevice liberally. currentpagedevice is not an expensive operation (it does not construct a dictionary on the fly, but just returns the page device dictionary in force at the time). All hooks are called after the setpagedevice operator has merged its operand dictionary with the page device, so currentpagedevice returns the up-to-date dictionary.

In many cases it is desirable to augment the behavior of existing instances of a hook rather than overwriting it. This can be done by concatenating procedures. If the procedures have any parameters, you need to duplicate them so that both the original procedure and the new one can access them.

Where the procedure returns a result (EndPage is the obvious example), it is less clear what should be done. In the case of EndPage, this illustrates a likely interaction between the old procedure and the new, which is likely to cause problems.

The most likely candidate for concatenation is Install; an example follows:

TEXT
<<
  /Install [ % note square brackets, not braces
    currentpagedevice /Install get
    /exec load % not just exec: it would execute immediately
    { ... additions ... } bind
    /exec load % executes the new procedure
  ] cvx % convert to executable procedure
>> setpagedevice

If you print the result (with ==), as in:

currentpagedevice /Install get ==

you should see something like:

{ {...old Install procedure...} -exec- {...additions...} -exec- }

Alternatively, insert the old procedure into the new one to achieve the same result, like this:

TEXT
<<
  /Install { null exec ... additions ... }
  dup 0 currentpagedevice /Install get put
  bind
>> setpagedevice

You may find the latter variation easier to read; however, remember that bind makes a procedure read only, so the put operator fails if the procedure was already bound.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.