Example page features
This page applies to Harlequin v13.1r0 and later; and to Harlequin MultiRIP but not Harlequin Core.
It is possible to write all the necessary code for pagebuffer
redirection as a page feature. This is a simple example, and should be made more robust for production use.
TEXT
%!
% Page feature to send pagebuffers to a different directory
% Notes:
% The directory is fixed, and here within the SW directory, but
% you can edit this page feature to use a directory elsewhere.
% Non-existent directories are created when device is first used.
% If setting up other redirections, copy this feature then
% 1. change name and /Prefix directory for the device,
% 2. create a new device of DeviceType 30 and set the /IODevice to
% be the name of the device in step (a) and
% 3. use the new device name as /RasterRedirectRDWR of the
% pagebuffer% device
% 1: Set up a target directory and mount a device on it.
% This is a persistent change within this ScriptWorks session.
% Use of devstatus detects already mounted device
% but does not check if /Prefix is the same or different, so
% any change to this page feature is effective only when
% ScriptWorks is restarted
statusdict begin
(%pgb-redir1%) dup devstatus
{
9 { pop } repeat
}
{
dup devmount pop
<<
/Password 0
/DeviceType 0
/SearchOrder -1
/Prefix (redir1/)
/Enable false
>> setdevparams
} ifelse end
% 2: setup a device of DeviceType 30 and make the above device
% the IODevice. This is a persistent change within this SW
% session.
mark (%pgbrdwr1%) devstatus not
{
{
(%pgbrdwr1%) dup devmount pop
<<
/Password 0
/DeviceType 30
/IODevice (pgb-redir1)
/SearchOrder -1
/Enable false
>> setdevparams
} stopped
} if cleartomark
% 3: Make the target directory the RasterRedirectRDWR for the
% device
% set up in step 2. This change holds for this job only.
(%pagebuffer%)
<<
/Password 0
/RasterRedirectRDWR (pgbrdwr1)
% /RedirectFileNamedWithJobname false
>> setdevparams
% 4. Tell the page device to use the redirection device
% This change holds for this job only.
<<
/OutputRedirect true
>> setpagedevice
% 4: Pagebuffer files are named <jobname>-<pagenumber>.PGB
% Duplicated pages have +1, +2 added
% For example: <jobname>-<pagenumber>+1.PGB
% Uncomment RedirectFileNamedWithJobname line in step 3 above
% to get a name like <jobnumber>-<pagenumber>-<separationnumber>
% .PGB
% OR
% Uncomment next (setuserparams) line to set up a fixed
% jobname for use in the filename
% OR
% Add suitable code if you wish to vary the name, based on
% resolution or other parameters s appropriate.
% NOTE: Redirection does not escape any special characters in
% the pagebuffer name, however created.
<< /Jobname (rdjob) >> setuserparams
% end of example redirect page feature