All PCL Command Sequences begin with the escape
character (an ASCII control code with a
hex value of 1Bh, 27 decimal) and end with the first upper case letter (or
"=" note: "@" is considered an uppercase letter). In between there is either
nothing (the PCL command is just the escape and a single upper case letter)
or a set of one or two characters and often a numerical value. The single
character commands are listed at the end of the "Decoded PCL Commands" table
below. The first non-uppercase character after the escape will be a symbol
between "!" and "\" (most commonly one of %,&,( or *) which is called
the "parameter." After the parameter there is normally a lower case letter
called the "group." After this there may be a numeric value. If no value
is present, the value is assumed to be zero. Finally the ending uppercase
letter is called the "command."

See Examples, Tutorials below for some samples of
PCL commands and the Decoded Commands List for
detailed information. Note that these use the text "Ec" to mean the escape
character. Since the escape character is not printable, it is very hard to
convey in human readable text. Common abreviations are Esc, Ec,
[], or <-. See the
ASCII page for more information on the codes.
That page also allows you to convert between hex, decimal or ASCII codes.

ASCIIcontrol commands
and HPGL (after PCL command to enter HPGL
mode) are also acceptable in PCL 5. Printers that support PJL (Laserjet 4
and later) should be told to use PCL should be entered via the
PJL ENTER LANGUAGE command.

Most of the problems people have with PCL are caused by not being aware
of all the codes that are being sent to the printer and how they interact.
Application programs, the language engine under the application, operating
system printer drivers, network print que, and any number of other things
will add codes to the print job before it reaches the printer and can cause
the printer to behave in ways that are not expected. To understand why the
printer prints as it does, you need to see what it saw.

There is a code that will allow you to see what is actually being recieved
by the printer. Send
esc&s0CescY to the
printer before you print your problem job or as the first codes in the problem
job. This command tells the printer to print all following commands rather
than excecute them. You will get very funny looking printouts, but if you
"decode" them by looking at each PCL command that the printer recieved and
learning what it does (see the list below), you will begin to understand
why the printer printed what it did.

If you don't see any change after sending these "debug" codes before your
main job, your network connection may be resetting the printer between jobs.
You may need to move the printer to a local parallel port connection to debug
the problems. When you do see the print codes and you want to return the
printer to normal operation, you must cycle the printer power to get the
printer out of this debug mode.

1) embeded data with no command preceding it, usually hex 20es, like: "1b 2a 70 38 39 32 58 25 26 27 28 29 27 24 2a 2b 29" - here you can see a horisontal cursor movement command, but right after x58 I get a string of 20es, related apparently to nothing.
What is this stuff and is there a way to predict it lengthwise? My guess was content to be drawn right after a movement, but I would like to predict it's appearance to parse it properly.

2) Sometimes I get a x0d byte at the end of embeded data, like so: "1b 2a 76 36 57 00 01 08 08 08 08 0d"
Sometimes it's on the end of unpredicted data I mentioned in 1), like so: "1b 2a 70 31 38 33 32 58 29 27 24 2e 2f 30 240d"
It appears other places too, like right after exit from PJL and entrance to PCL following the x0a(newline) byte, like so(PJL is ascii for clarity): "@PJL ENTER LANGUAGE=PCL 0a 0d".
What is this byte for and can I predict it's appearance?

when moving from HPGL to PCL and back, it seems the PCL code:
ESC&a1r1C
is affecting the HPGL pen command by moving down -7. (one can assume one pcl ROW). Has anyone heard of this interaction before? James Newton of MassMind replies: It is more likely that you have a carriage return, and/or line feed in the stream that is moving you down one line. These codes can't be seen in a normal editor, and are sometimes inserted by the output command in programming languages without the programmer realizing it. Use the PCL debug commands to force the printer to print the codes in the job, rather than executing the codes, and see if some unexpected characters show up in that area.+

Hello,
I'm trying to utilize PCL and macros to get a report to print correctly. Basically, I have 1 Logo image (which I used ImageMagick to convert to PCL from a BMP), I have 1 barcode PCL file (that I generated via a program I wrote which draws rectangles for each bar) and obviously the report itself). My intention was to simpley dump the logo and barcode PCL files into a single PCL file, wrap them with a macro, and enable macro overlay right before printing report. My problem is, upon doing this I end up with 2 pages. 1 with only the Logo, and 1 with the barcode/report. I've tried hand altering the pcl file to get it correct, however, the converted/logo file doesn't look like standard pcl, looks like binary garble. I also found that hand creating a pcl logo wrapped with macro commands will immediately print once submitted to the printer, even without me executing the macro, it's almost as if something in the logo/pcl/binary/garble is triggering the printer to print/mis-interpret the data stream. Any idea what could be causing my macro to basically page break mid print? I can provide samples etc.. if you can respond with an email address I can send samples to. Thanks for any assistance you can provide.

Hi, guys. My first time asking, please don't shoot me for nubishness.
I am parsing some PCL5 and I ran into some peculiar stuff:

1) embeded data with no command preceding it, usually hex 20es, like: "1b 2a 70 38 39 32 58 25 26 27 28 29 27 24 2a 2b 29" - here you can see a horisontal cursor movement command, but right after x58 I get a string of 20es, related apparently to nothing.
What is this stuff and is there a way to predict it lengthwise? My guess was content to be drawn right after a movement, but I would like to predict it's appearance to parse it properly.

2) Sometimes I get a x0d byte at the end of embeded data, like so: "1b 2a 76 36 57 00 01 08 08 08 08 0d"
Sometimes it's on the end of unpredicted data I mentioned in 1), like so: "1b 2a 70 31 38 33 32 58 29 27 24 2e 2f 30 240d"
It appears other places too, like right after exit from PJL and entrance to PCL following the x0a(newline) byte, like so(PJL is ascii for clarity): "@PJL ENTER LANGUAGE=PCL 0a 0d".
What is this byte for and can I predict it's appearance?

"we can create a macro for you given the logos or other text, etc.. you wish to see on the page.+"
THANK YOU for offering to make a macro and code for me. I simply want to put a header (letterhd.bmp) and a footer (letterft.bmp) as an overlay on the top and bottom of a DOS program printer output (ie letterhd on top, then the letter, then letterft on the bottom). I need to the macro to bring in the header - allow the letter, then bring in the footer - which are .bmp files. THANK YOU!

I would like to put a letterhead and a footer graphic as an overlay on a dos output letter(.bmp, but I can convert to any format). Please tell me how to do this; the dos program allows sending an initial and ending file command for letter printing, as well as a few custom entered esc sequences during the printing. Thank you!!

James Newton of Massmind replies: You would need to make a PCL Macro file with the commands to draw the letterhead and footer inside it (see Macros). If your graphic includes a bitmaped logo, you will need to include that as PCL commands (See Bitmapped Pictures). The completed macro would then need to be enabled for overlay (&f4X) and will then appear on top of each printed page. It's important to avoid any printer reset or macro commands between the definition and overlay of the macro and the actual print data. Alternatively, we can create a macro for you given the logos or other text, etc.. you wish to see on the page.+

Hi, Is it possible to print a string between 2 fixed positions on the paper. I mean even if string is long, cutoff the rest after the end position. If i use Esc*p500x500Y, it will print full string.

James Newton of Massmind replies: I think the only way to cut off the end of the string is to "erase" it with an opaque white rectangle after you have already written it out. That's NOT a clean solution, I know... You might try playing with the left and right printable margins...+

How to write a simple
program in pcl languageJames
Newton of James Newton's Massmind replies: PCL is not a programming
language. It is a printer control language and more generally a page markup
language. Having said that, the standard "Hello World" program is:EscEHello WorldEscE
where Esc is replaced with the single ASCII escape character. Variables can
be defined and recalled through macros. There are
no decision statements (such as IF or FOR) other than the number of copies
command, the only input is from the host and the only output is to the
paper.+

I have been told that I can take a TIFF image file and prefix it with a PCL
command to use in an IBM z/Os PCL2AFP conversion tool. What is that command
and what exactly do I do with it? We are hoping to be able to use this in
batch processing.

James
Newton replies: I do not believe that is correct. There are simularities
between the encoding of certain types of TIFF images and the PCL image
encoding, but the headers are different so they would have to be stripped
from the TIFF before the PCL header is added. Instead, I would look for existing
programs that convert images to PCL.
ImageMagick is one
possibility.+

Am trying to print company logo at the top of report. I opened the logo in
word and printed to a file and ftp to unix and called that file from report.
It is printing fine but skips a page. How can I solve that - skipping of
page after printing the logo?
James
Newton replies: Any commands at the end of the logo file or the beginning
of the print job that specify page setup (orientation, tray, paper size,
etc...) will cause a page eject between. Remove the job setup from the mail
print job and rely on the page setup at the start of the logo or convert
the logo to a pcl macro and insert a macro call in the main
job.+

For a report made by a system that can only output text files, I want to
create squares around some text areas using PCL. However when I try to change
the horizontal cursor position, nothing happens. A square would only show
top, bottom and left lines. I tried this using &a#H, *p#X and
&a#C. I use PCLreader software or direct to a HP2550Lj printer.
Any suggestions on what could cause this?

James
Newton replies: Ah, yes, common error. The issue is the carriage returns
and line feeds between the codes. Each CR/LF returns the cursor to the left
edge of the page. Putting all the codes on one line fixes the
problem.+

How do I type the same character (or pattern) twice without moving the cursor
on or stepping the paper on? We are trying to use PCL in a final year project
at university to print a mask for an integrated circuit application where
exact registration between the printed layers will be critical... We are
not very familar with PCL and HP don't seem to want to help. Many thanks

James
Newton replies: I'm not sure I understand what you mean by "moving
the cursor on" but I assume you want the cursor to stay in or return to the
place it was before you typed the character. I also don't understand how
that applies to registration between layers. However...

You can save the cursor position before and restore it after each character
with the &f#S commands.

A carrage return without a line feed will return the cursor to the start
of the line without advancing down the page if you have end of line termination
set to &k0G.

The cursor can be returned to the start of the page with *p0x0Y after any
amount of text has been printed, without triggering a page eject as long
as the text does not exceed the bottom margin of the page.

I am wondering whether PCL5 or PCL6 supports CMYK? I understand that PCL
supports CMY color space, which means each pixel could have three components,
i.e. C, M and Y. Printer might generate a K component by itself. However,
if I want to generate the K component and pass to the printer, how to do
it? In the other words, how to make the printer take all 4 components (CMYK)
for every single pixel of the image?

I am trying to print barcode (interleaved 2 of 5) along with data. I am
formatting the data in PCL and submitting it to CUPS, which ultimately routes
it to Lexmark T632 printer. I am able to print the text data, but cannot
create barcode with interleaved 2 of 5.

I am not sure I am asking the right question?

Any input or guidance will help.

Thanks,

James
Newton replies: PCL doesn't have any inherent ability to print barcodes.
If the printer has a font, you need to find the PCL code to select it (print
a typeface list from the printer front panel) and then send that before the
data. 2 of 5 also has an encoding that you must deal with. It should be
documented with the font or with the font documentation for the printer.
There are also some printers (I seem to remember Brother printers) or additions
for printers (Barcode JetCaps DIMMs for HP, IIRC) that do all the work for
you: Just send the selection code and the data and the encoding is managed
automagically. Another way to do it is to write application code that translates
the data into PCL area fill commands to draw the barcode
directly.+

Dear Sirs
I always have used PCL5 but now I need PCL6 for an older DOS program (foxbase).
The printer is an HP LaserJet 2840 AIO and does not support PCL5. Just a
few commands wil do: changing to ARIAL and back to COURIER and changing the
pitch or height of the letter.
Many thanks

James
Newton replies: Unlike PCL5 which is basically ASCII printable text
with commands added via the escape, PCL6 is ALL commands. E.g. There is a
command to print text. I am not aware of any method of supporting PCL6 from
a DOS app, but I would love to be proven
wrong.+

the printer shows on its display A3 paper needed if the tray is empty or
e.g. A4 paper is in the tray. I wanted to know if this is normal for PCL
printer, because in the reference manual is nothing mentioned about this.
Thanks for your help
Joerg
James
Newton replies: This is a function of the printer, above and beyond
what language is used to describe the
page.

Hi,This belongs to
the &s1C problem. Thanks for the answer. To answer your question : It
doesn't matter if I remove this command or if I set the size command before
the &s1C command. In both cases it shows the required page size is missing.
If I set SubPageSize to Auto on the device itself, than the device shows
the correct page size is missing, even if the &s1C command is send before
the &l27A command. Can someone test this on a HP printer? Best regards
Joerg
James
Newton replies: I don't understand why you mentioned the &s1C
command at all? The operation you see is as expected. The printer will look
for the page size it has set as the default size to use as a replacement
size unless you tell it SubPageSize=Auto.+

Hi, I have a problem.
I'm sending an A3 pcl print job to the machine, the selected tray is out
of paper, then the device shows the default paper size is missing ( set the
default to 8 1/2 X 11 it shows this size ) but it should show A3 paper is
missing. I figured out that in the pcl stream the Esc&s1C command is
send before the page size Esc&l27A. If I change this all is fine. But
the PCL Reference don't specified to send this command in an order. Thanks
in advance.
James
Newton replies: When you say "change this" do you mean that you are
now sending the &s1C after the page size? Or that you removed the &s1C?
In any case, it sounds like the &s1C was interferring with the page size,
and that is, very certainly, something that is not documented and quite
interesting.+

I am trying to get a Brother Laser to print from DOS type commands and it
seems to accept the PCL5 commands but never prints the data. What does it
take to get the data to actually print. All of the examples show ...data
here... and I assume its just normal ascii data. Can someone please tell
me if this is true.

James
Newton replies: It isn't clear from your question if a page actually
comes out of the printer. If not, you need to send a page eject command.
If so, then the only things I can suggest are that the text has been positioned
off the printable area, an opaque white area fill has covered over the text,
that the size has been set very small (e.g. 1 point) or that the pattern
transparency or color have been set such that the text is not visable. Also,
make sure you are using a printer that actually supports PCL directly. Many
low end units are "WinPrinters" which depend on the host to render the PCL
into a bitmap which is all the printer understands how to
print.+

What does the flag '9' mean in PE command? The 'Introduction to HP-GL/2 Vector
Graphics' says that the flag in PE command can be '>' '<' ':' '=' '7'.
So I've found a prn file which contains 'PE9=' command. How could it be
explained?

Hello, i have a problem with PCL. I try to set the cursor to a horizontal
position to align amounts along the decimal comma (invoices). But i dont
find any about this problem in the HP-Documentations or Internet. Ist there
a way to align amounts correctly? Is it possible to set the horizontal position
not only left?

I have tried the Escr-4U,Esc*v2S to set foreground color on the HP Business
Inkjet 1200, but that doesn't work. It doesn't speak the original PCL. Can
anyone help, thanks !
James
Newton replies: Consult the technical manual for that printer. It
is available from HP.com. +

I am trying to run a fix program to take out extra blank pages, which are
added in an automated process for putting together a document from many different
places in a database. Unfortunately, reorganizing the database to take out
the extra Print resets and/or page breaks is not an option.

On to the question, what, if any, is the difference in the position a cursor
starts on the next page between a printer reset (ec E) followed by a cr /
lf and a page break followed by cr / lf?
James
Newton replies: None as far as I
know.+

Pixel Placement
ESC l [#] R This command determines how pixels are rendered in images.
Two models are used for rendering pixels when an image is placed on paper:
0 Grid Intersection Model
1 Grid Centered Model
This command can be invoked multiple times during a page. It has no effect
except to switch the model being used for imaging.

James
Newton replies: Thank you for noting that. I believe that is actually
a typographical error in the hitachi documentation. The HP docs list that
as ESC * l # R which is more believable and seem to work on my printers.
In either case, this command was missing from my list, so I appreciate your
adding it.+

Hi, thank you for the answer and forgive me but I'm again here with a question.
I can't get a circle by the command CL in HP-GL/2 mode (nothing happens,
nothing is printed). The listing INSP1PA2400,2500EW500,0,360; works but the
listing INSP1PA2400,2500CL500; doesn't. I'm doing timing tests, so using
one command instead of another can make a difference. Could you please help
me one more time. Thank you. Dina Sukhanova

I have written my own file on PCL-language. It works: prints 800 lines and
cirles in Hp-GL/2 mode, but only on one page. How can I add transferring
to a new page. Actually it should be 10 pages. My task is to test different
printers. Thank you in advance. Good luck in your job. Dina Sukhanova

James
Newton replies: Just exit HP-GL mode, add a formfeed character (ASCII
12) or any PCL page setup command.+

I am trying to ptint labels on a paper source that is 12 inches long. I can
use most of the paper but at the bottem of the page it stik the last two
inches. This then move that part of the page to the next page. Is thier a
command that will allow me to set the page length to 12 inches or a set of
command that will do this.

James Newton replies:
You should be able to send the
esc&l3A command to set the page
size to legal (14") then avoid printing past
12".+

@spam@je.keatingspam at @spam@sfs-creative.co.uk
asks: " Can I use PCL commands to submit to
a printer a start command to use a specific Truetype font and then to stop
and default back to another font. "
James Newton
replies: You can select a font to the secondary font and then use
the shift in and shift out ASCII codes to switch back and
forth.+

@spam@johnclaibornespam at @spam@altec-inc.com
asks: " When different symboles (Other than
the original letters in the text) are being used for each letter.... What
determines the substituted symboles ? "
James Newton
replies: The whim of the programmer. In most cases, it is based on the
order of appearance of the symboles in the original print
job.+

" James
Newton replies: Refferring to the ASCII
chart, 1B 2A 70 2B 30 58 is Esc*p+0X which is effectively a "NOP" or null
operation. It does nothing. The *p command is for cursor positioning. The
X at the end indicates that this will affect the X (horizontal) position
of the cursor. The + sign means that the change will be relative to the current
position and the value 0 changes the position by 0/300ths (or 0/600ths if
you are at 600dpi, etc...) of an inch. So... no change. If it was Esc*p+1X
then the cursor would advance to the right one pixel. Esc*p-1X would move
the cursor one pixel to the left. Esc*p0X would move the cursor to the left
edge of the printable area. As to why someone would add that in a PCL file?
I would guess that the PCL was generated by a program and that the program
was too dumb to know that it didn't have to "move the cursor zero places"
when it happened to already be at the desired
location.+

I have this bat file I created using the code under Drawing Rectangles (PCL),when
I run it I get this message '<-' is not recognized as an internal or external
command operable program or batch file. Not sure what I am doing wrong, I
have tried it with and w/o the *, putting a space before the * and after
*, I even placed '>prn at the end of every line. I have window 2000 as
my OS can this be the problem. (I also tried it not using the dos editor
and got the same results.

then if that prints something to the printer, use the instructions at
Using DOS EDIT on an IBM PC to
set up test files to enter the PCL commands from the Drawing Rectangles
page in place of the word "hello". Remember, the Ec character is not really
and "E" and a "c". In DOS EDIT, it will appear as a left pointing
arrow.+

Hello I have a PCL problem . I have a PCL file and I want to extract the
text from it . Like : at position 10,10 I have : "This is the beginning"
..... 10,100 : "This is the end" Is this possible ? I am totally beginner
in PCL , and as I saw the file doesn't contain the characters I want to print
instead some graphical stuff.

James Newton replies:
Based on your description (especially the part about the text not being
present in the file) I would guess that the fonts are being downloaded and
that different symboles (other than the original letters in the text) are
being used for each letter.

I am trying to create invoices for 4si and 8000n printers. I am getting the
invoice form/macro loaded and called correctly with data, but would like
more. It seems I cannot select to load the form first and then the data,
it always does it data then form. Can this be corrected? I would also like
a watermark to print on top/below the form and data. Is the a way to get
this done?

Hi there, I am tring to print some boxes on my page and the printer (laserJet 5000N) does not seem to recognise the box commands:
048= p900x2100Y
049= c100a100b0P
I convert the to char 27, the printer just prints "900x2100Y" and "100a100b0P". I have tried the GL/2 commands and they work although with the absolute positioning starts from bottom left hand corner.
Thanks for your informative site.

I working on printer driver. I am trying to print bitmap on HP 930c PRINTER.
I would like to get esc sequence to print the same.
[ I tried Esc * b # V sequence, but not working] .Please help

James
Newton of James Newton's Massmind replies: Try sending the following:
esc*t300R followed by esc*b8WU3//@~@~ about 30 times. You should see a nice
black and white pattern that looks something like:

W W W W WW WW W WWW W WWW W WWWWWWW W WWWWWWW

Basically this is a pattern of fine vertical lines that get thicker to the
right. For more see the page on
printing
pictures in PCL.+

After you find an appropriate page, you are invited to
your
to this massmind site! (posts will be visible only to you before review)
Just type in the box and press the Post button.
(HTML welcomed, but not the <A tag:
Instead, use the link box to link to another page.
A tutorial is availableMembers can
login
to post directly, become page editors, and be credited for their posts.

Link? Put it here:
if you want a response,
please enter your email address:
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.