% zadjustpagedevice dict --
% Similar to setpagedevice but attempts to preserve much of the graphics state
% across the call. For level 2 PostScript ONLY.
/zadjustpagedevice
{
/zpagedevicedict zxdf
% Save everything.
matrix currentmatrix
currenttransfer currentgray
systemdict/currentcolorscreen known
{
currentcolorscreen true
}
{
currentscreen false
}ifelse
zpagedevicedict setpagedevice
% Restore everything.
{
setcolorscreen
}
{
setscreen
}ifelse
setgray settransfer setmatrix
}zbdf
%----------------------------------------------------------------------------
% zsetmultipurposepagesize --
% Matches and thus sets the page size for the multipurpose tray.
/zsetmultipurposepagesize
{
systemdict/setpagedevice known
{
% Check for LaserWriter NTR or LaserWriter Pro
zisntr{0}{zislwpro{1}{-1}ifelse}ifelse
% stack: -- 0, 1, or -1.
% LW NTR multipurpose tray = 0, LW Pro multipurpose tray = 1
dup 0 ge
{
1 dict dup begin/InputAttributes 1 dict dup 4 index
1 dict dup/PageSize currentpagedevice/PageSize get put put def end
zadjustpagedevice
}if pop
}if
}zbdf
% zmanualfeedoff --
% Turns manual feed off.
/zmanualfeedoff
{
statusdict/manualfeed known
{
statusdict/manualfeed false put
}if
}zbdf
%---------------------------------------------------------------------------
% zselectmediasource source --
% Selects the given paper source (tray) for auto feed. Should only be called
% on LW Pro.
% Source values are 0, 1, 2, 3 meaning respectively: 250 sheet standard
% cassette, multipurpose tray, 500 sheet optional cassette, optional envelope
% feeder.
/zselectmediasource
{
% Save the source request into the priority array.
1 array astore/zmediasourcepriority zxdf
% Turn off manual feed.
zmanualfeedoff
% Check for presence of setpagedevice operator
systemdict/setpagedevice known
{
% Verify tray presence.
currentpagedevice/InputAttributes get zmediasourcepriority 0 get
% stack: dict key --
known
{
% Update the current page device (select the tray).
% We also force the current page device to the PageSize of
% the selected tray -- this will force the paper to be drawn from
% the requested tray regardless of the paper size actually sensed
% by the tray (i.e. this will override auto page size matching).
4 dict begin/InputAttributes 1 dict dup/Priority zmediasourcepriority put
def
/PageSize currentpagedevice/InputAttributes get zmediasourcepriority 0 get
get/PageSize get def
/ManualFeed false def
/Policies 1 dict dup/PageSize 1 put def currentdict end zadjustpagedevice
}if
}if
}zbdf