Operating System - HP-UX
1819901 Members
2507 Online
109607 Solutions
New Discussion юеВ

Re: 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
Dave Holgate
Advisor

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

Bill,
well... i haven't been successful yet. almost everything you've written i've found correct, except about the interface file. it seems like whether i create a new queue with addqueue, or use the one i have (reg1atrn), i don't get a file with any "def" settings in it in /etc/lp/interface. i DO see files with those settings in /etc/lp/interface/model.orig/... also, the banner which prints when i print from unix is in there; i know 'cuz i added my initials to the "Output Summary" line, which is echo'd out in that script, and it printed on the banner page.

however, if i change the script in /etc/lp/interface/model.orig/reg1atrn, it doesn't seem to affect the destination of the printjob. i added the line:
outb="2", then tried it with outb="3".

assuming i'm fixing the right file (i'm partly right?, as this method definitely changes the banner that's printed), is there something i need to do to make the changes "take effect"?

if i'm NOT fixing the correct file, i don't know where to turn next; i've attached the /etc/lp/interface/reg1atrn file, since i couldn't attach both files - i guess i could attach it to another post...

did i miss sumthin? ;^O
dave
Dave Holgate
Advisor

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

and here's the /etc/lp/interface/model.orig/reg1atrn file (attached)
Bill Hassell
Honored Contributor
Solution

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

The model script you are using is a net_lj3x, in other words, for a LaserJet 3 which was new about 1989. Printers with trays were a long time after that. The reason that addqueue picked this is that multifunction printers are very new and you need to upgrade hppi with all the new printers you are using. Here is the website:

http://www.hp.com/pond/modelscripts/index2.html

Once you download and install this model script, delete the current printer with:

deletequeue -h myprinter

and then add it back again with addqueue. If it does not pick the net_lj4100 script, use addqueue -l to list all the available printers. Look for the 4100 and note the ID number. Then add the printer using addqueue and add the -i option with the ID number. That will add the printer with the correct model script. Now your -o options for the trays will work. Always test WIHTHOUT your application (ie, lp -dmyprinter -osomething...). Once the trays work OK, then add the printer again as mentioned above and you'll see all the "def" options in the script.


Bill Hassell, sysadmin
F Verschuren
Esteemed Contributor

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

I use to change the line:
paper="def"

to
paper="a4"
or
paper="leter"

If you tel you printer that all the paparsze leter is tray 3 it wil than print from tray 3.
Dave Holgate
Advisor

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

Bill,

JEEEEEEEEEEPERS!!! we're ONLY 20 years behind, no need to get grouchy!!!! ;^)

seriously, though, i thought that there might've been something weird going on when your otherwise accurate instructions and descriptions suddenly went awry! i'll check this out and get back to you as soon as i can, hopefully today. this is my priority today, so, i'll be working on it.

thanks, so much, Bill and everyone, for your suggestions.
dave
Dave Holgate
Advisor

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

all:

well... this has been a nightmarish learning experience!!!

what i discovered, eventually, is that there actually WAS programming code controlling the trays in the VAR software - an obscure insert to an even more obscure program, which executed this line:
PRINT RESET:CONDENSED:LOWER.TRAY

now, another insert controlled these variables, setting LOWER.TRAY as such:
019: ESC = CHAR(27)
020: RESET = ESC:'E'
021: DPI.600 = ESC:"&u600D"
022: LOWER.TRAY = ESC:'&l4H'
023: PAGE.LEN.88 = ESC:'&l88F'
024: ENV.FEEDER = ESC:'&l6H'
025: HP8000.TRAY1 = ESC:'&l4H'
026: HP8000.TRAY2 = ESC:'&l1H'
027: HP8000.TRAY3 = ESC:'&l5H'
028: HP8000.TRAY4 = ESC:'&l20H'
029: HP8000.ENV = ESC:'&l6H'
030: DUPLEX.OFF = ESC:'&l0S'
031: DUPLEX.ON = ESC:'&l1S'
032: DUPLEX.ON.LAND = ESC:'&l2S'
033: FORM.FEED = CHAR(12)

notice how someone programmed "LOWER.TRAY" and "HP8000.TRAY1" to the same escape sequence, which clearly was printing to tray 1 (or the "manual feed tray" as i call it to remove any doubt). this is why no matter what i did at the Unix level, the printer was getting those escape sequences in its data stream, and over-riding the Unix settings, and printing to tray 1.

so, i fixed that, and now the string says:

* LMC Mod
BEGIN CASE
CASE V.TRANSCRIPT.GROUPINGS.ID = "GA" OR V.TRANSCRIPT.GROUPINGS.ID = "UA"
PRINT RESET:CONDENSED:HP8000.TRAY2
CASE V.TRANSCRIPT.GROUPINGS.ID = "G" OR V.TRANSCRIPT.GROUPINGS.ID = "U"
PRINT RESET:CONDENSED:HP8000.TRAY3
CASE 1
PRINT RESET:CONDENSED:HP8000.TRAY1
END CASE
* PRINT RESET:CONDENSED:LOWER.TRAY: ;* this points to the manual feed tray, actually!!!!!
* JD End-Mod

so, basically, print unofficial transcripts to tray 2, official transcripts to tray 3 (with pre-printed paper), and all other jobs to tray 1 (will never happen in this pgm).

this all seems to work.

however (and there always is one!), now i have a different problem. i can't seem to control other print jobs to NOT pull from the preprinted forms in tray 3. i CAN set the printer paper types in the different trays - no problem - and i think that's the generic way to handle this. however, what i'm finding is that this printer (HP4100MFP) is being printed to with a net_lj3x interface file. i can't see it currently because i'm replying, but i think that's one of the things we've talked about in prior pieces of this thread. my problem is that when i did everything we talked about: created a new printer, adjusted it to force printing on tray 3; when i printed on it, it only printed part of the job, namely the first line... the rest of the 2 pages which printed were blank. i'm pretty sure that some kind of code or escape sequence is in this VAR software which is really confusing the net_hp4100 driver. so, i can't use it yet... and therefore, i can't use the more sophisticated (or at least, more modern) features like 'mtype="Preprinted"' until i figure it out. ;^( if i could use them, i could control it better. i'll keep trying to figure out why this driver doesn't want to work, yet.

i'll get there eventually... thanks for all of your support, you've been VERY helpful...
thanks,
dave
Dennis Handly
Acclaimed Contributor

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

>Bill: deletequeue -h myprinter

Bill has corrected this to use:
removequeue -q myprinter