tray selection using lp command

I have a HP laserjet 9000 printer on a Sun Solaris server.
I try to print using lp command to different trays. But it gives an error. The command that i used is lp -dprinter_queue -otray2 file_name

Hi,

See if this helps...

a. On a per job basis, specify the media to print
   to either by size or by tray number:
   1. By size:
        lp -d<queue> -o<paper size>
        where <paper size> is one of the following:
        legal, letter, A3, A4, A5, A6, exec, ledger,
        11x17, B4-JIS, B5-JIS, B5-ISO, B6-JIS, com10,
        com10env, PostCard Single, PostCard Double,
          custom, C5, C5env,
        DL, DLenv, monarch
   2. By tray number:
        lp -d<queue> -o<tray specification>
        where <tray specification> is one of the
        following:
        tray1, upper, ub, ubin, tray2, lower,
        lb, lbin, tray3, tray4

b. To configure a default for all jobs in a
   particular queue, run the following commands:
   1. cd <model directory>
   2. cp <queue> <queue>.tmp
   3. sed -e 's/paper="def"/paper="<paper size>"/'
      <queue>.tmp > <queue>
        NOTE: Above command is all on one line.
   4. rm <queue>.tmp
   where:
     <model directory> is:
        /usr/spool/lp/interface/model.orig on HP-UX 9.x
        /etc/lp/interface/model.orig on HP-UX 10.x
        /etc/lp/interface/model.orig on HP-UX 11.x
        /etc/lp/interfaces/model.orig on Solaris
     <paper size> is one of the following:
        legal, letter, A3, A4, A5, A6, exec, ledger,
        11x17, B4-JIS, B5-JIS, B5-ISO, B6-JIS, com10,
        com10env, PostCard Single, PostCard Double,
        custom, C5, C5env, DL, DLenv, monarch

   The above commands will set the default paper
   size of the specified queue.

In short, edit /etc/lp/interfaces/model.orig/* and replace `paper="def"'
with `paper="letter"'. (Twiddle paper selection to suit your needs).
In your fav editor, searching for `paper=' drops you on the spot, or you
can sed it out as listed above.