1753918 Members
7667 Online
108810 Solutions
New Discussion юеВ

Re: PCL Code in UNIX

 
Chicco100
Occasional Advisor

PCL Code in UNIX

Hello @all,

i have a Problem with the PCL Code. I don't understand, how i use the PCL code in Unix.

I would to change the tray2 to tray1, with the PCL code. I use for this ^[&l4H and ^[&l1H.

In unix i try: echo ^[&l4H |lpr -Pprinter_name, but doesn't works.

Can anyone help me please?????

THX
18 REPLIES 18
TTr
Honored Contributor

Re: PCL Code in UNIX

The echo command above would just echo the file name out to a piece of paper. Does it actually print from the correct tray?

You should put the PCL codes into two files, and use the cat command

cat | lpr ....
rariasn
Honored Contributor
Bhadresh
Trusted Contributor

Re: PCL Code in UNIX

Hi,

following thread discuses about the using PCL with lp command in UNIX:

http://forums11.itrc.hp.com/service/forums/questionanswer.do?admit=109447626+1276536871023+28353475&threadId=127230

Regards,
Bhadresh
Bill Hassell
Honored Contributor

Re: PCL Code in UNIX

> In unix i try: echo ^[&l4H |lpr -Pprinter_name, but doesn't works.

Are you running HP-UX or Linux? HP-UX uses the SysV print spooler and the command is lp, not lpr.

PCL is just a series of special codes that are inserted in front (or sometimes in the middle) of the print job. NOTE: the code ^[ usually refers to the escape (ESC) character so it must be represented correctly. There are a couple of ways to do this, but this is the most portable:

echo "\027&l4H"


For use with HP-UX or Linux, you can do this (ASSUMING you are using a POSIX shell such as ksh):

( echo "\027&l4H" ; cat ) | lpr -Pprinter_name

This will insert the appropriate codes in front of the file to be printed.


Bill Hassell, sysadmin
Elmar P. Kolkman
Honored Contributor

Re: PCL Code in UNIX

What printscheduler are you using? You might use CUPS on HP-UX, for instance. That has some influence on what command you need to use.

But since you use lpr, why not try something like a '-o tray2' option for the lpr command?
Every problem has at least one solution. Only some solutions are harder to find.
Chicco100
Occasional Advisor

Re: PCL Code in UNIX

How can I creat a PCL-file? I write the PCL-Code in VI.

cat | lpr -Pprinter don't work.


Bill Hassell
Honored Contributor

Re: PCL Code in UNIX

In vi, you use the CTRL-v key to remove the special meaning from the next character. So to put in the codes: ESC &l4H, you star with a blank file, type i to insert characters, then CTRL-v then the ESCAPE key (which puts ^[ on your screen) followed by &l4H. Then press the ESCAPE key again and save the file.

Or you can do it like this without vi:

echo "\033&l4H" > tray2.pcl

Now you can use cat:

cat tray2.pcl file-to-print | lpr -Pprinter_name

Note: lpr is not lp. On HP-UX, lpr is a wrapper for lp that emulates lpr. However, -otray2 is not valid for the lpr wrapper and won't work on HP-UX if you do not access the HP printer directly with HPPI software.


Bill Hassell, sysadmin
Chicco100
Occasional Advisor

Re: PCL Code in UNIX

Hi Bill,

Or you can do it like this without vi:

echo "\033&l4H" > tray2.pcl

Now you can use cat:

cat tray2.pcl file-to-print | lpr -Pprinter_name

This not work.

cat:tray2.pcl: No such file or directory
Chicco100
Occasional Advisor

Re: PCL Code in UNIX

The printer prints the Pcl File.

/033&l4H
the printer not understand the pcl code.

I do all, but i have no success. :(