LaserWriter Pro 630: Switching Paper Trays w/ PostScript

Is there any tray select software, or Postscript files available to switch trays on a Laserwriter Pro 600/630 on a Unix computer?
Yes, the following postscript functions codes to select and print to different paper trays on a LW Pro 630 using the "lpr" command under A/UX. Note that the postscript codes below must be inserted in a Postscript (ready) file. For printing text files you can first use the "enscript" program which converts text files to Postscript format. For example, "enscript -pout.en out.txt". The following values passed to the /zselectmediasource function 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

Note: Lines which start with % are the comments in Postscript.

For example, the following codes segment (appended at the end of defined functions) selects the letter sized paper from the 500 sheet tray:

letter
zsetmultipurposepagesize
2 zselectmediasource

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.


PostScript source code

% 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

Published Date: Feb 19, 2012