Avatar of johnsit
johnsit
Flag for United Kingdom of Great Britain and Northern Ireland asked on

PCL language/escape codes (selecting paper source when printing) from HPUX

Hi,

We have recently procured a Brother HL-6050 printer.

In UNIX (HP-UX) we have a program that requires a single program output to be printed on A5 (optional tray) whereas the default be A4 (tray 1).

If I place the following line in the header of the output print header of the program,

disp "\033&l5H\c"

Then the program prints from the optional tray (currently with A4 in it).

So far so good....

Now I replace the A4 paper in the optional tray with A5 paper and run exactly the same program. Now instead of using the optional tray as the source it starts to use tray 1 again (the wrong tray).

Any ideas much appreciated!
Printers and ScannersUnix OSNetworking

Avatar of undefined
Last Comment
johnsit

8/22/2022 - Mon
SOLUTION
tfewster

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
DansDadUK

>> Try sending "\033&l4A\c" (Specify A5) instead of (or as well as) the tray selection string

I support tfewster in his/her supposition that specifying a PaperSize of A5 (as well as the tray identifier) is probably what is required.

But I don't think that the suggested code is correct.

The 'select PaperSize' escape sequence has the generic form:

<esc>&l#A

where:

<esc> represents the escape character (the character with decimal code 27, or hexadecimal 1B, or octal 033).

the character after the & (ampersand) is a lower-case L (not a digit 1)

and where the standard # values include:
#=2 for Letter
#=26 for A4
#=25 for A5

The \033 is the *n*x method of specifying (in octal) the code-point value of the Escape character.
... but I've no idea what the \c means; the PCL5 escape sequence is complete at the 'A' termination character.
DansDadUK

I've found the answer to my own little question about what \c signifies:

"UNIX Korn shells use the \c escape character to signal continuation (no automatic line break)"

So it presumably stops the 'disp' command from adding LineFeed (0x0a) and/or CarriageReturn (0x0d) characters to the output string.
DansDadUK

... and if you want to experiment with different combinations of PaperSize, PaperType and TrayIdentifier PCL5 sequences, use the 'TrayMap' tool in the PCLParaphernalia application (see http://www.pclparaphernalia.eu ).

It won't run on HP-UX; it's a .NET 4.0 application, so would require a modern Windows system to run it on.
Your help has saved me hundreds of hours of internet surfing.
fblack61
johnsit

ASKER
Thanks for all the great help so far!

Im a bit new to unix and PCL, so to clarify, what would I use for the complete code on one line using the following codes?

\033&l4A\c
\033&l5H\c
\033(s12.5h\c

Would it be

disp "\033&l5H\033&l4A\033(s12.5h\c"?

Thanks again.
ASKER CERTIFIED SOLUTION
DansDadUK

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
DansDadUK

... and here is an analysis of the compound statement:

 
<Esc>&l25a        Page Size: A5
       5H         Paper Source: id 5 is Printer Dependent
<Esc>(0N          Primary Font: Symbol Set (identifier = 0N)
<Esc>(s0p         Primary Font: Spacing: Fixed
       12.5h      Primary Font: Pitch (12.5 characters per inch)
       0s         Primary Font: Style (Upright, solid)
       0b         Primary Font: Stroke Weight: Medium
       4099T      Primary Font: Typeface (identifier = 4099)

Open in new window

DansDadUK

... but if your application/driver already inserts a 'Set Page Size' sequence (for, say, 'A4') in the output print stream, if you select 'A5' by adding the required sequence 'in the header', then you'll possibly get a blank A5 page (but maybe not, depending on what else is in the stream)) followed by the data on A4 page(s).
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
johnsit

ASKER
Thanks very much DansDad,

Probably one of the best and complete answers Ive received!

I have awarded 400 to yourself and 100 to tfewster for the initial tip, hope this OK.

Very much appreciated.
johnsit

ASKER
Thanks.