Skip to main content
Skip table of contents

Changing the environment of a job between pages


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

Sometimes it is necessary to change the environment (namely, whether or not you are doing imposition) between pages. Where the data affected is global, this is straightforward—it is just changed in BeginPage or EndPage as required. Global data includes system parameters.

However, when the data is subject to save and restore , or gsave and grestore, such as the graphics state or local VM, it is likely not to survive.

A good example of this is overriding the screen angles in a pre-separated job. Such jobs often go:

currentscreen exch pop angle exch setscreen

near the beginning of each page. While the Harlequin RIP has system parameters which override the screen frequency and spot function, or the whole screen, in Version 3.2 there is no parameter for screen angle alone. However if, for example, the BeginPage procedure calls sethalftone with the Override flag set to prevent the job from then changing screens, the new value is restored back to the previous screen immediately (probably the one set by the very first BeginPage).

In this case, record the value required for the current page in global memory in BeginPage and apply it every time the job tries to change things for itself, by redefining the operator. The redefinition could be done in userdict, as the following example illustrates, but might be better done by shadowing the operator, details of which are given in Shadowop and operator redefinition.

TEXT
userdict begin

  currentglobal true setglobal
    /ScreenDict 2 dict begin
      /AnglesRequired [15 75 0 45] def
      currentdict
    end def
  setglobal

  /setscreen {
    % must also redefine setcolorscreen and sethalftone!
    //ScreenDict begin
      exch pop AngleForThisPage exch setscreen
    end
  } bind def

  <<
    /BeginPage { % page count on stack
      //ScreenDict begin
        /AngleForThisPage AnglesRequired 3 -1 roll 4 mod get def
      end
    } bind
  >> setpagedevice

  currentdict /ScreenDict undef
end
JavaScript errors detected

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

If this problem persists, please contact our support.