[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1227
  • Last Modified:

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!
0
johnsit
Asked:
johnsit
  • 6
  • 3
2 Solutions
 
tfewsterCommented:
Possibly the printer believes A4 is needed (or is told by the driver/app) and therefore the printer switches to a tray that has that size.

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

0
 
DansDadUKCommented:
>> 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.
0
 
DansDadUKCommented:
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.
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
DansDadUKCommented:
... 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.
0
 
johnsitAuthor Commented:
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.
0
 
DansDadUKCommented:
There are several errors in your *n*x representation of the required PCL5 compound parameterised escape sequence.

- As mentioned before, the standard # value for a PaperSize of A5 is 25, not 4; Brother documentation mentions 25, but not 4 (I don't think that 4 is assigned to any size).
So the first sequence would be (in *n*x notation) \033&l25A

- The third sequence is a partial font selection sequence; but the termination character should be upper-case H (not lower-case h) as it is not a term within a 'combination' sequence.
So the sequence would be (in *n*x notation) \033(s12.5H

... and as it is only a PARTIAL font selection, it will only have the desired effect (to select a pitch of 12.5 characters-per-inch) if the currently-selected font is a fixed-pitch font (like Courier or Letter Gothic).

So your compound string would be:

disp "\033&l25A\033&l5H\033(s12.5H\c"

or (taking advantage of PCL5 'combination' sequences - those with the same 'root'):

disp "\033&l25a5H\033(s12.5H\c"

... and the following should select Courier 12.5 cpi Regular, using the ISO 8859/1 character set, using a full font selection sequence, as well as the paper/tray selections:

disp "\033&l25a5H\033(0N\033(s0p12.5h0s0b4099T\c"
0
 
DansDadUKCommented:
... 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

0
 
DansDadUKCommented:
... 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).
0
 
johnsitAuthor Commented:
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.
0
 
johnsitAuthor Commented:
Thanks.
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

  • 6
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now