PCL Command Sequences

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.

ASCII control 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.

After the escape character...
char
type
bits to
store
max range known (commonly used) values
from to
parm 4 21h 2Fh %,&,(,),*
except for 9, E, Y, Z, and = which are considered commands (two character - no parm, group, or value) but come directly after the escape.
grp 4 60h 7Eh a,b,c,d,f,l,p,r,s,t,u,v
value 15-16 -32767 +65535 will be either 0 to 32767, -32767 to +32767, or 0 to 65535. May have a decimal.
cmd 5 60h 7Eh a,b,c,d,e,f,g,h,l,m,n,o,p,q,r,s,t,u,v,x,y,z
When another value and cmd will be sent for the current parm and grp.
40h 5Eh @, A,B,C,D,E,F,G,H,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z
When this is the last value and cmd for the current parm and grp

parm: <!...\>?.
group: <`...~>?.
digits: <0...9>?.
number: digits | '.' | digits ?.
               | ?.
value: | sign number ?
       | number ?
esc | parm | group [ value | lowercase? command ? PCLParmCmd ]
                           | 'W' @+value ? PCLParmCmd .
                           | uppercase? command ? PCLParmCmd .
    | '=' ? PCLSingleCmd .
    | '9' ?
    | 'E' ?
    | 'Y' ?
    | 'Z' ?
    | error .

See:

Examples, tutorials

See also:

Questions:

Comments: