Operating System - HP-UX
1846850 Members
3132 Online
110256 Solutions
New Discussion

Re: Using rmodel to insert printer escape sequences

 
Doug Weaver
New Member

Using rmodel to insert printer escape sequences

I have a LaserJet4 printer attached to my network via an Intel NetPort print server. This requires me to define this printer to my HPUX server as a remote printer with the BSD system option enabled.

My goal is to customize an interface script (using rmodel as the starting point) so that the -olandscape option will actually work when used with the lp command.

My lp command will look like this:
lp -dtestprtr -olandscape testfile

Here are the changes I made to the /usr/spool/lp/interface/testprtr script (created from rmodel):

for i in $5
do

#
# check for 'regular' lp options
#
case "$i" in
hpgl | hpgl2 | pcl | raw) # Files assume no page breaks.
BSDformat=-l
;;
ps | postscript) # Files contain Postscript data.
BSDformat=-o
;;
#My changes start here
landscape)
sed -e '1s/.*/^[\&l1O/' -e '$s/.*/&^[E/' $6 > $6.new
cp -f $6.new $6
;;
#My changes end here
esac

This code results in escape sequence Esc&l1O (landscape orientation) being inserted at the beginning of the first line of the print file, and EscE (reset printer) being inserted at the end of the last line.
I have verified that this code does indeed result in the escape sequences being inserted at the proper places prior to the execution of the rlp command.

The problem is, when the file prints on the printer, the printer ignores the escape sequences. Instead, the printable characters of the escape sequences simply print as text at the top and bottom of the print out.

Now, the weird part is, if I do the following:

sed -e '1s/.*/^[\&l1O/' -e '$s/.*/&^[E/' testfile > testfile.new
lp -dtestprtr testfile.new

the printer DOES observe the escape sequences imbedded in the print file!!
I don't understand what is different in these two scenarios, because the content of the printfile should be identical in both.

Any help would be appreciated.
4 REPLIES 4
Printaporn_1
Esteemed Contributor

Re: Using rmodel to insert printer escape sequences

Hi,

Send ESC sequence not support in remote printing , cause all formatting was done at printer owner.

enjoy any little thing in my life
Mark Ikenberry
New Member

Re: Using rmodel to insert printer escape sequences

I am having a similar problem. I am trying to send my print in compressed form. Have you had any luck with a solution?
Stefan Farrelly
Honored Contributor

Re: Using rmodel to insert printer escape sequences


This is strange. On our Laser4's and 5's the lp -olandscape option works fine with the standard printer model script -no customization necessary. Is there something strange with your printer setup ? are you routing prints through some non HP box (a PC or NT box or something) which is stripping off the landscape stuff, or is the printer setup aok ??
Im from Palmerston North, New Zealand, but somehow ended up in London...
Steve Steel
Honored Contributor

Re: Using rmodel to insert printer escape sequences

Hi

Try doing it without the BSD option selected.

You have the same script but the spooler sends the -olandscape through when BSD is not selected.

Otherwise

Put echo "\033&l1O\c" in another file and print by

cat otherfile printfile|lp -dremoteprinter

Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)