Printer escape sequence problem

We've been using a method of changing printer fonts for several years on Solaris 7 but the same script is a problem on Solaris 9.  On Solaris 9 the job prints correctly but continues to print multiple copies until the job is stopped.  Here is the script that we use.

cat begin.txt /group1/tax/CODE1/COLL/ end.txt | lp -dhp5 -t "TAX COLLECTOR CODE1" -o banner

The begin.txt and end.txt files that are concatenated are as follows.  The boxes in this sequence are the escape character in the original file.


The being.txt sequence does a printer reset, duplex long edge binding, portrait orientation, and 16.7 characters per inch.


The end.txt sequence sends a job separation and a printer reset.

Can anyone point out what is causing this problem or show me a better way of accomplishing this?  

Thanks in advance!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Try replacing the encoded escape characters with "\033" (the octal representation of ESC); A PCL printer should recognise the representation and process them properly
davidshockeyAuthor Commented:

That didn't work.  We got at page that printed the escape codes followed by an incorrectly formatted document.  

But it only printed once! ;-)
Try to use "-r" with lp to make sure your file is not filtered in any way, eg:

lp -r -dhp5 -t "TAX COLLECTOR CODE1" -o banner

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

I've just tried this on a Solaris 8 and a Solaris 9 system, and I can't see a difference.

As you said, putting "\033" instead of the Esc character didn't work; Sorry!

Please check that all the "" characters are valid escape characters:

> od -c begin.txt
0000000 033   E 033   &   l   1   S 033   &   l   0   O 033   &   k   2
0000020   S  \n

> od -c end.txt  
0000000 033   &   l   1   T 033   E  \n

How are these printers set up? Access directly across a network or going via a  Unix/Windows/print server?
davidshockeyAuthor Commented:
Apologies for the delay in getting back.  This is a problem that another developer is working on and so you're getting replies filtered thru me.


We tried your suggestion and there was no change in the behavior except that the banner page lists an invalide option: stty=-opost.


We tried the od as you suggested and the only difference that we found was the existence of the newline in your listing.  We placed a newline in our version and tried again... no joy.  

These printers are accessed directly across a network with an external JetDirect device attached to the printer.  There is no print server involved.

One thing I've noticed that I didn't know before is that each copy of the output has its own banner page and there is some time delay between copies.  
davidshockeyAuthor Commented:
Our SA created a new printer using the JetDirect utility on the Solaris 9 server and guess what... it works just like the old one.  She says that the old one was created in the same way and doesn't see a difference between the two.  

Thanks for the help, I'm splitting the points between you two.
Weird - I was testing using a similar environment, and couldn't reproduce the problem. So I was thinking remote print server setups or printer models might be the difference.

I avoided using Jetadmin, I just used lpadmin to ensure I knew exactly what had been set up...

Anyway, glad to hear you've fixed the problem and thanks for the points!
I never have to use third party package (eg Jetadmin), to setup a printer in Solaris, I have
a lot of HP network printer (with built in NIC), can see any problem between different version of Solaris.  It might have someting to do with your  JetDirect  settings.

and thanks for the points.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.