cancel
Showing results for 
Search instead for 
Did you mean: 

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
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. :(

Steven Schweda
Honored Contributor

Re: PCL Code in UNIX

> The printer prints the Pcl File.
>
> /033&l4H

I can't see what's in your "Pcl File".

man od

od -c

You did notice that "\033" and "/033" are
different, right?

I can't see exactly what you did with your
"Pcl File". As usual, showing actual
commands with their actual output can be
more helpful than vague descriptions and
interpretations.

> the printer not understand the pcl code.

I also know nothing about your printer.

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

"all"? Really? Then I guess that there's no
reason to continue trying.
Chicco100
Occasional Advisor

Re: PCL Code in UNIX

Hi,
I meant \ 033 but it does not work. The printer prints just the PCL file. But does not interpret the code. Our printer is a HP Laserjet 4650 and is a network printer. I did it like in the example of Bill
Steven Schweda
Honored Contributor

Re: PCL Code in UNIX

> [...] I did it like in the example of Bill

Which part of this was not clear?:

--------

I can't see what's in your "Pcl File".

man od

od -c

[...]

I can't see exactly what you did with your
"Pcl File". As usual, showing actual
commands with their actual output can be
more helpful than vague descriptions and
interpretations.

--------

> [...] HP Laserjet 4650 [...]

Ok. So the specs say that it can do "HP PCL
6, HP PCL 5c (Web download), HP postscript
level 3 emulation, native PDF printing,
[...]". If you're sending it PostScript,
then trying to throw in some PCL may not be
the best way to get the desired result. But
I don't know what you're actually sending it.


For the record, I was looking at these
printer specs:

http://h10010.www1.hp.com/wwpc/us/en/sm/WF06a/18972-236251-236268-15077-f58-375773.html
Bill Hassell
Honored Contributor

Re: PCL Code in UNIX

The specs for this printer says PCL6 (not good for Unix) and PCL 5c (no clue as to whether this is standard PCL. Sorry to bear the bad news but unless a printer is plain old PCL 5 or less, the printer may not be able to be controlled by 'normal' codes. Although you said this is on the network, are you printing directly to the printer or are you printing to a print server such as Windows which then sends the file to your printer?

More and more printers from HP are being designed without ASCII capability. PCL1 through PCL4 are plain ASCII with extensions in the form of escape sequences. PCL5 (no suffix like 5c or 5e) is also OK, but PCL6 and beyond are proprietary codes that require a special driver -- mostly for current Windows only.

So back to the original question, what does the command: uname -a return?


Bill Hassell, sysadmin
Chicco100
Occasional Advisor

Re: PCL Code in UNIX

uname -a
Linux ***** 2.6.5-7.312-bigsmp #1 SMP Fri Jun 6 13:44:33 UTC 2008 i686 i686 i386 GNU/Linux

I print without a print server
Bill Hassell
Honored Contributor

Re: PCL Code in UNIX

> uname -a
> Linux

That would have helped a lot at the beginning. This is not the Linux forum - it is for HP-UX. That's why all the references to the lp command and printer scripts for JetDirect printers.

You'll need the CUPS system installed and configured for your printer. Check this page:

http://www.cups.org

and specifically:

http://www.cups.org/documentation.php/options.html

You'll need a PPD file for your 4650. Then you can use the -o options. Use the lpoptions command to see what is available for this printer.


Bill Hassell, sysadmin
Chicco100
Occasional Advisor

Re: PCL Code in UNIX

Sorry Sorry!! It was a misunderstanding.

But now its work with the Option command
Bill Hassell
Honored Contributor

Re: PCL Code in UNIX

This link might be useful to you and also to the people who have helped you solve this question...

http://forums13.itrc.hp.com/service/forums/helptips.do?#33


Bill Hassell, sysadmin
Chicco100
Occasional Advisor

Re: PCL Code in UNIX

Ok, Thank you Bill!