Skip to main content
Skip table of contents

Adding custom page device keys

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

A custom page device key is usually added to control some feature of an output device from the PostScript language.

For example, most printers do not support duplex (double-sided printing). Therefore the Duplex key is not present in the supplied page device dictionary; if your printer does support it, add the standard key Duplex. Alternatively, your printer might support a feature for which there is no standard key; add one of your own. For example, some laser imagesetters allow operation using a double-facet prism. If single- or double-facet operation is selectable, you might have a key DoubleFacet that controls from the PostScript language whether it is used or not.

Another example: Consider a “printer” that is actually a fax machine. You might then want a key /PhoneNumber to tell the fax what number to dial. Ideally you would want the phone number to be specified by the application originating the PostScript-language job. One way to do this is to adopt a convention for the document so that its name contains the phone number: you could analyze the name by parsing the comments at the top of the job (see Comment parsing ) and generate an appropriate call to setpagedevice. Alternatively you could provide a set of encapsulated PostScript-language files containing the appropriate code for setting the phone number, which users could import into their documents.

For Harlequin Core, controlling output devices (raster backends) is usually done using RasterParams.

You can add and remove keys dynamically; when used in conjunction with a plugin, some of this mechanism is automatic (see below). For this purpose, the RIP has a page device key called /ExtraPageDeviceKeys. Its value is a dictionary containing keys to be added and their default values. See ExtraPageDeviceKeys (page device).

For example, you could add the key /PhoneNumber as follows:

  /ExtraPageDeviceKeys <<
    /PhoneNumber () % default: empty string
>> setpagedevice

A later call to setpagedevice can then make use of it:

<< /PhoneNumber (+44 444 5551212) >> setpagedevice

Any keys introduced by ExtraPageDeviceKeys are automatically passed on to the %pagebuffer% device just before each page is output, using the setdevparams operator. Implementing setdevparams means that only numbers, names, strings and Booleans are acceptable as extra page device keys added in this way.

In HMR, the PostScript-language part of this process is largely automatic. Extra page device keys are nearly always specified in a plugin. This allows the parameter to be set from the PostScript language, or set by a dialog (which is, in fact, an editor for the PostScript-language fragment which sets the parameter); the value to be transmitted from the GUI version’s implementation of the %pagebuffer% device to the plugin at the time the page is output. In this case, the extra key is added automatically; when a device is selected in the Page Setup dialog, PostScript-language code is generated for an ExtraPageDeviceKeys dictionary containing all the keys given by the plugin in response to the D_GETSTIOTEMPL selector. The values for these keys are determined by the defaults provided in response to the D_GETSTIODATA selector, or as subsequently modified by the user in the Configure Device dialog. The code generated is stored in the file Config/Page Setup. The Configure Device dialog does not need for all the parameters to be available: if they are not, they are only modifiable from the PostScript language. The purpose of this section is to show how extra page device keys are handled in PostScript language, the plugin programming details are given in Output Plugin Selectors. The page device can only be extended when the Harlequin RIP is started; it is not possible to pass the values directly through to a plugin. This means that the dynamic method is often not useful in HMR. However, in single modes you can write the values to a file that the plugin can then read, or in simple combinations, to use media selection and OutputAttributes: see below.

There is also a one-off file mechanism for adding keys: New keys are added in a file Sys/ExtraPageDeviceKeys which is executed as the Harlequin RIP starts up. After the file is executed the stack should contain a set of alternating key/value pairs (note: not a dictionary). Typically, this means the required keys and default values are placed in the file verbatim, though since the file is being executed it is possible to use expressions there too. Keys added using the Sys/ExtraPageDeviceKeys file are not automatically passed on to the %pagebuffer% device, unlike those added dynamically. However, the page device key PageBufferSetup is a hook that you can use to process parameters in whatever way is required, including passing them on to the %pagebuffer% device. See PageBufferSetup procedures for details.

If the file mechanism introduces a new key that already exists in the current page device, then the new value replaces its current value. This provides a method for defaults for built-in keys to be replaced on start-up without the side-effects of executing setpagedevice.

If the dynamic mechanism introduces a new key that already exists in the current page device, then its value is ignored.

JavaScript errors detected

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

If this problem persists, please contact our support.