Caution: If you choose to use the PostScript code provided in this article, you assume all risks involved in making these changes. PostScript code, if not entered correctly, can place the LaserWriter into a condition requiring service.
We have used the following postscript functions code to select and print to different paper trays using the "lpr" command under the A/UX command shell. The below postscript code must be inserted in a Postscript (ready) file. For printing text files you can use the "enscript" program to convert text files to Postscript format:
enscript -pout.en out.txt
Basically, the following values passed to the /zselectmediasource function will select the desired tray:
0 zselectmediasource % select the standard 250 sheet standard tray
1 zselectmediasource % select the multipurpose tray
2 zselectmediasource % select the optional 500 sheet tray
3 zselectmediasource % select the optional envelope feeder
Also the following code segment (appended at the end of defined functions) will select the letter sized paper from the 500 sheet tray
letter
zsetmultipurposepagesize
2 zselectmediasource
Lines started with "%" are comments in Postscript.
% Paper source selection code for the LW Pro.
% Copyright (c) ) Apple Computer, Inc. 1992-1993
/zbdf
{
bind def
}bind def
/zxdf
{
exch def
}zbdf
%-------------------------------------------------------------------------
% zislwpro -- boolean
% Returns true if product is LaserWriter Pro 600 or 630.
/zislwpro
{
statusdict begin/product load end dup(LaserWriter Pro 630)eq
exch(LaserWriter Pro 600)eq or
}zbdf
%-------------------------------------------------------------------------
% zisntr -- boolean
% Returns true if product is Personal LaserWriter NTR.
/zisntr
{
statusdict begin/product load end(LaserWriter Personal NTR)eq
}zbdf
%-------------------------------------------------------------------------
% 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
Article Change History:
08 Feb 1995 - Added PostScript caution message.
Support Information Services