Operating System - HP-UX
1838658 Members
13709 Online
110128 Solutions
New Discussion

help with printer's interfac

 
Thi Vu
Frequent Advisor

help with printer's interfac

Hello everyone,

I have an HP Laserjet 2100TN that is set up as a remote printer on different Unix boxes. It is printing fine from Window and Unix applications; however we now want to be able to print French char. automatically from the Unix boxes (ie. the conversion is done by the printer's interface script before it sents out to the printer).
I had tried a few methods:

1) Modified the "rmodel" interface script to do the conversion using "iconv" command before sending the output, it does not work. The printout has weird characters.

2) I found one article in the archive that suggest to copy the interface script from /usr/lib/lp/model/model.orig and modified it "... to always print the PC-8 French characters and US English characters: by
Change:
case "$charset" in
def);;
*) .....
To:
case "$charset" in
def) "\033(19U\c";;
*) .....

These are the steps I did after modified and renamed interface script to FrePrint:
>lpshut
>lpadmin -p -orm -orp -v/dev/null -mFrePrint -ocmrcmodel -osmrsmodel
>lpsched
>accept
>enable
>lpstat (the message I got was
printer queue for
JetDirect lpd: no jobs queued on this port
no entries )
>lp -d
request id is (1 file)

BUT - there was no print-out; the print queue is empty; the lpstat report the same as above and /var/adm/lp/log reports no error.

I pinged the printer and it's OK. I telneted to the printer and it brings me to the prompt no problem. I don't know where to go next. Any help is appreciated. Thank you in advanced.

Thi


8 REPLIES 8
A. Clay Stephenson
Acclaimed Contributor

Re: help with printer's interfac

Hi:

I suspect that you need to change the

def) "\033(19U\c";;
to
def) echo "\033(19U\c";;

otherwise the shell will attempt to interpret the string as a command and I don't think it will find that command.


If it ain't broke, I can fix that.
Thi Vu
Frequent Advisor

Re: help with printer's interfac

Hi Clay,

I tried with echo "\033(19U\c" it's the same result as above - no print out. However this time I put set -x in the script and the print out from the "set -x" show:
printer=printername
reqid=printername-idnum.
user=vuthi
title=
copies=1
options=
.... and no errors reported.

Thi
A. Clay Stephenson
Acclaimed Contributor

Re: help with printer's interfac

Hi Thi:

I think I see what you did. If I understand correctly, you essentially replaced an rlp model script with a local printer script that is sending its output to /dev/null. As far as the unix box knows, everything is working just fine.

If you are trying to do this, I think you will need to set up the printer as a jetadmin printer on one of your servers and then rlp to that printer from the other boxes.

Clay
If it ain't broke, I can fix that.
Jordan Bean
Honored Contributor

Re: help with printer's interfac

I've never worked with charset conversions, but I do have an interface script (attached) which passes the data file through the PCL5 model script before giving it to rlp.

The PCL5 model script uses iconv to handle conversion from any UTF8 codeset (either specified or assumed from env vars LANG or LC_ALL) to any ISO codeset.

Use this interface script and try:

lp -o'fr_FR.utf8 dcs=iso88591'

I'm interested to know what happens.
Thi Vu
Frequent Advisor

Re: help with printer's interfac

Hi Jordan,

After a few modification (i.e. environment and variable ...) I did the print command as
lp -d -o'dcs=cp437'

I did not get any error report, I did not get a print out. I went and did the lpstat and I got this message:

# enable ts_print
printer "ts_print" now enabled
# lpstat ts_print
ts_print-842 root priority 0 Jul 27 10:09
foo 20 bytes

printer queue for ts_print
JetDirect lpd: no jobs queued on this port
NEWTON: Warning: ts_print is down

the /var/adm/lp/log does not report any error.

#######################

Hi Clay,

Yes, from what I understand of the "lpadmin" I can choose the model interface script for the printer I set up (I did not see that it is for the local printer only), but if I add the remote printer thru SAM then rmodel interface script is default - thus I set up the printer via lpadmin command line.

So from my understand of what you are saying is that:

1. I can not chose any interface script for a remote printer ??? Once we set up a remote printer - there is only one interface script the rmodel ???

2. In order for me to take advantage of the different interface scripts for the remote printer (ie: PCL5 interface script for one type of laserjet printer and/or laserjet interface script for another type of laserjet printer and so on...) - I have to set the printer up as a "network" printer via Jetadmin thus I must purchase the software ??? Is there a cheaper way ?

Thi

A. Clay Stephenson
Acclaimed Contributor

Re: help with printer's interfac

Hi Thi:

No JetAdmin is freely available as a download.
I was surprised why you were not using it in the first place. The advantage of using one box as a jetadmin printer and the others as rlp's is that you change one interface.

Try this site:
http://www.hp.com/cposupport/prodhome/jddlmx9.html
If it ain't broke, I can fix that.
Bill Hassell
Honored Contributor

Re: help with printer's interfac

Since the destination is a JetDirect printer, there is no need to use rlp--in fact, rlp is a poor choice in that all the -o options are ignored. Once you download and install the HP-UX JetDirect software, you can very easily add the printer with the addqueue command.

Then you can customize the local script which will be found in /etc/lp/interface/model.orig with the same name as your print queue (printer name). The JetDirect scripts are picked automatically based on the printer's response to a model query. The man page for the script (tytpical PCL5 printers) is net_lj5x and you'll see there are a large number of options available.


Bill Hassell, sysadmin
Thi Vu
Frequent Advisor

Re: help with printer's interfac

Thank you everyone for helping me, but I had to go back to my first option - modify the rmodel interface script. I had been working on that script for 3 months and I did not work, but today I added 2 lines (chmod 740 $1) to the script and it worked. This is what I added into rmodel interface script:

# this is just for me to check if the file did actually got converted - debug. I'll remove this and the $convfile later once it's tested by users.

conlog=/var/adm/lp/iconvlog
if [ ! -d $conlog ];
then
mkdir -p /var/adm/lp/iconvlog
fi

chmod 740 $1
/usr/bin/iconv -f iso81 -t cp437 $1 >$conlog/$requestid
cp $conlog/$requestid $1 > /var/adm/lp/log 2> /var/adm/lp/log


I don't know why I had to do the "chmod" above but it seems that if I did not have that in, the $1 did not get picked up by /usr/bin/iconv for conversion (the $conlog/$requestid file was created but it's empty) but instead the files got picked by /usr/sbin/rlp and sent out the output.

Bill is right about rlp. It is not a very good because when you choose one of the options -the /var/spool/lp/request/ logged the option but the output did not show the option. However, this is what works for now and this is the one they choose.

Once again, thank you everyone for helping.

Thi