John,
The trick with tray select codes is to make sure that they
are sent to the printer BEFORE there is any printable
data on the page. The same is true of page size commands.
Otherwise, the printer will eject the page from the current
tray before the change takes place.
So if you can find in your filtering script the point at
which the page size command is sent, insert your tray
select code there. Assuming this is shell script of some
kind a "letter size" command might be
\033&l2A
This assumes the use of the octal \033 for the escape.
The tray select for let's say, the 500 sheet tray
might be
\033&l5H
Once a tray is selected, it remains the current paper
source until the printer is reset at the end of the job
or another tray is selected.
Jim Asman