General
cancel
Showing results for 
Search instead for 
Did you mean: 

how to direct print job to a particular tray, from Unix, using existing printer "form"

 
SOLVED
Go to solution
Dave Holgate
Advisor

how to direct print job to a particular tray, from Unix, using existing printer "form"

i posted this originally in the Printer forum, but was advised to put it into the "unix forum" - i hope i've found the correct place! please provide a link if i'm still "lost" ;^)
dave (02/15/08)


Feb 14, 2008 19:10:53 GMT
i have an HP4100TN multifunction printer, running on an HP-UX 11.11 system.

i have a "queue" called reg1atrn, which is used only for printing transcripts, and prints to this hardware device (via network, presumably using the IP address - i'm not a "network guy", so i don't really understand this kind of magic!). i need to make this queue (it's really a "form") print to tray 3.

i've looked at lpadmin, hppi, hpnpl... and lots of other stuff. however, i can't seem to figure out how to change this existing queue to print to tray 3 of the hardware device (HP4100TN).

help?
thanks!
dave holgate
holgatdb@lemoyne.edu
315.445.4572
16 REPLIES 16
Tim Nelson
Honored Contributor

Re: how to direct print job to a particular tray, from Unix, using existing printer "form"

Typically the application will send the code for tray selection but....

If you look at the printer driver ( really just a script. Look to see if there are tray selection options. You can then either use them on the lp command line or hard enable by setting up an alias like prn1try2 with the hard coded settings.

If there are not tray options listed in the interface file then you can create your own by reading the printer book for the escape codes.

If this is a network attached printer your driver file is in /etc/lp/interface/model.orig/PrinterName

Tim Nelson
Honored Contributor

Re: how to direct print job to a particular tray, from Unix, using existing printer "form"

ubin) echo "0 setpapertray";;
lbin) echo "1 setpapertray";;

Looks like ubin for upper and lbin for lower.

lp -dprinter1 -o ubin /etc/copyright





Eric Antunes
Honored Contributor

Re: how to direct print job to a particular tray, from Unix, using existing printer "form"

Hi Dave,

I use this command from Oracle to print to tray3:

lp -c -d$PROFILES$.PRINTER -n$PROFILES$.CONC_COPIES -omtypePreprinted -t"$PROFILES$.TITLE" $PROFILES$.FILENAME

The "-omtypePreprinted" is the one you are looking for. But be sure that the tray3 is assigned for Preprinted paper...

Best Regards,

Eric
Each and every day is a good day to learn.
Dave Holgate
Advisor

Re: how to direct print job to a particular tray, from Unix, using existing printer "form"

Gentlemen:

thanks for the rapid replies! let me give a little more detail...

this printer is a networked printer with a (built-in, i think) JetDirect card, so that it can function as a Windows printer AND a Unix printer. we're running a database called Unidata (also called "IBM U2") on top of Unix, and a value-added software package on top of Unidata. i don't have the granularity to execute the lp commands; essentially, the VAR package "passes through" with an unformatted job to Unidata, which passes it through to Unix; so, essentially, i'm printing through Unix, but without the control of executing the lp command specifically. there is a program which runs when the user logs into the VAR software, and this program executes an 'lpstat -a' to find all the printers, and sticks them in an array which the VAR software displays whenever a user tries to pick a printer or form for their printjobs... i can't get at the printer itself (at the time that the user is printing), and so the printer itself (or "forms queue" in this case) must have the characteristics i want available already.

so that you understand where i'm coming from, i'm experienced with Unix and "Data BASIC" (originally known as "Pick", also "Prime Information") programming for upwards of 30 years, meaning essentially that i understand 'everything' about how Unix, Unidata, and Datatel work together, and have access to root, and would be considered a fair-to-middling Unix administrator.)

so... i wouldn't want to change the base model's script or interface file, since that would then affect all those printers with the same model number... am i right about that?

what i want to do is for that specific "forms queue" called reg1atrn (and there are numerous "forms" printing to this hardware device, i guess due to the fact that they all point to the same IP address), i want it to print to tray 3... i don't want to affect the other "forms queues".

does that make sense?
thanks...
dave
315.445.4572
holgatdb@lemoyne.edu
Eric Antunes
Honored Contributor

Re: how to direct print job to a particular tray, from Unix, using existing printer "form"

Hi Dave,

I don't know what you mean by a "form queue" but, don't you use the lp command?

Eric
Each and every day is a good day to learn.
Dave Holgate
Advisor

Re: how to direct print job to a particular tray, from Unix, using existing printer "form"

well... i don't as a human use it; the VAR software passes the unformatted job to Unidata, which then passes it through to Unix. it's all in the software.

somewhere, yes, there's an lp command; but, it's not accessible to me either as a unix administrator, programmer, nor user.

in my ancient mind, i consider the "printer" to be the "hardware device" - usually a "dumb" device, like a line printer, but nowadays with PCL and all, they're actually "smart" - whatever! by "form" or "queue" i mean the software device in Unix which eventually results in something in black/white/color on a piece of paper in the bin of the "printer", or hardware device. there is certainly a one-one relationship between "printer" and "form" - one can't have a printer with out a form, even if the form is "assumed" or otherwise just the same as the "printer". BUT, there is a many to one relationship between "form(s)" and "printer", i.e., i can have multiple forms printing on one printer hardware device. this particular "printer" hardware device has multiple software "forms" associated with it, namely 'reg1trn', 'reglz1', and a couple of others. these could be different paper sizes, fonts, whatever, but they're software, not hardware.

so, without changing the base "printer" definition for the hardware device, i want to change the software "form" to print directly, and only, to tray 3.

i hope my nomemclature nor understanding of this is too outdated... or just plain wrong! but i think my theory is correct, and if i need to be corrected on vocabulary, so be it! i'm willing to learn!!! ;^O

let me know what you think...
and, thanks!
dave
Tim Nelson
Honored Contributor

Re: how to direct print job to a particular tray, from Unix, using existing printer "form"

Create a new printer exactly like the old one with a new name. i.e. printer1-b

Change the model interface to specifically use the bottom tray (hard set pagemode=lbin, there is a section in the interface file for this around line 594 if using the PCL5 driver)

Your app as you explained will now read a list with one more printer. Tell uers to use printer1-b for bottom tray printing.

Repeat the process for other types of options.
printer1-t (top tray)
printer1-l (landscape)
printer1-p (portrait )

and so on...

No where does it say that one printer cannot have many different names with different options ).

Bill Hassell
Honored Contributor

Re: how to direct print job to a particular tray, from Unix, using existing printer "form"

This is easier than it looks and Tim has the right idea. You create multiple queues pointing to the same physical printer. The networking keeps multiple jobs to different queues from clobbering each other.

But before we get started, you must have the printer connected using an HP JetDirect card in the printer. The fastest way to verify this is the hpnpadmin command:

hpnpadmin -v 12.34.56.78

where 12.34... is the IP address of the printer. If this returns a couple of pages of network and printer stats, you are all set. The last check is to print a plain document like /etc/profile to the printer using this command:

lp -dmyprn -obin2 /etc/profile

Note that -oubin and -olbin are for paper source, not output, The output trays are designated as -obin1, -obin2, -obin3, etc. The nice part is that you don't have to read the printer script and learn PCL codes to make it work. The man page for the printer script is on your system. Without knowing how the printer was setup, you can just use the man page for net_ljx000 for a list of the -o options. Note that unlike virtually every other HP-UX command, the lp command does not allow a space after the command line options (-obin2 not -o bin2).

Now, to create the additional print queues, just use addqueue to create as many queues as you need, something like this:

addqueue -q myprnbin2 -h 12.34.56.67 -b off -t off
addqueue -q myprnbin3 -h 12.34.56.67 -b off -t off

and so on (no practical limit). Now go into the interface directory and edit each printer's script to default the needed option(s). The printer scripts are in /etc/lp/interface. Leave the primary printer alone and just modify the extra printer scripts. You'll see all the defaults in the middel of the script -- look for: outb="def" and change it to outb="2" or whatever you would like to be the default.

Now you simply change your application to use a different printer.

All this assumes that the printer has an HP JetDirect card in it and the options do work when you use the lp command. For a short printed list of the commands, you can do something like this:

lp -dmyprn -ooptions /etc/profile


Bill Hassell, sysadmin
Dave Holgate
Advisor

Re: how to direct print job to a particular tray, from Unix, using existing printer "form"

Bill and Tim,

yes, i see now that Tim was correct all along! i think Bill's description matches my understanding of queue management, too, so thanks very much, Bill. the main reason for doing it this way is so that i don't have to customize my VAR software. it's a nightmare trying to manage the customizations!

i'll check this out as soon as i can, hopefully today or tomorrow. i'll report when i'm successful! thanks!
dave