The commands below are those of PCL 5 as found in HP LaserJet printers, written as
Esc plus characters (see escape
sequences); # stands for the value. Units: a decipoint is 1/720 inch,
and a PCL unit is 1/300 inch unless set otherwise with Esc&u#D.
Values are those of HP’s PCL 5 Printer Language Technical Reference Manual;
values marked † are listed only in HP’s PCL 5 Comparison Guide for later
printers. Colour commands are from HP’s PCL 5 Color Technical Reference
Manual. Printer models support different subsets; the comparison guide’s feature
support matrix says which.
Job control
| Command | Meaning and values |
|---|---|
Esc%-12345X | Universal Exit Language: leave PCL for PJL. |
Esc E | Reset. |
Esc&l#X | Number of copies, 1–32767. |
Esc&l#S | Simplex or duplex: 0 simplex, 1 duplex long-edge binding, 2 duplex short-edge. |
Esc&a#G | Duplex page side: 0 next side, 1 front, 2 back. |
Esc&l#U, Esc&l#Z | Left and top offset registration, in decipoints. |
Esc&l1T | Job separation (offset the output). |
Esc&l#G | Output bin: 1 upper, 2 lower (rear). † 0 automatic, 1–3 destination trays 1 to 3. |
Esc&u#D | Unit of measure: PCL units per inch (96, 100, 120, 144, 150, 160, 180, 200, 225, 240, 288, 300, 360, 400, 450, 480, 600, 720, 800, 900, 1200, 1440, 1800, 2400, 3600, 7200). |
Page control
| Command | Meaning and values |
|---|---|
Esc&l#H | Paper source: 0 print the current page (source unchanged), 1 printer-specific tray, 2 manual paper feed, 3 manual envelope feed, 4 lower tray, 5 optional source, 6 envelope feeder. † 7 auto select, 8 tray 1, 20–39 high-capacity input trays 2–21. |
Esc&l#A | Page size: 1 Executive, 2 Letter, 3 Legal, 6 Ledger, 26 A4, 27 A3, 80 Monarch envelope, 81 Com-10 envelope, 90 International DL envelope, 91 International C5 envelope, 100 International B5 envelope. † 25 A5, 45 JIS B5, 46 JIS B4, 71 Hagaki postcard, 72 Oufuku-Hagaki postcard, 101 custom. |
Esc&l#M | † Media type: 0 plain paper, 1 bond, 2 special paper, 3 glossy film, 4 transparency film. Later printers select paper by name instead with Esc&n#Wdname (for example Esc&n6WdPlain; # is the name’s length plus 1). |
Esc&l#O | Orientation: 0 portrait, 1 landscape, 2 reverse portrait, 3 reverse landscape. |
Esc&a#P | Print direction: 0, 90, 180 or 270 degrees counter-clockwise, for text. |
Esc&l#E | Top margin, in lines. |
Esc&l#F | Text length, in lines. |
Esc&a#L, Esc&a#M | Left and right margin, in columns. |
Esc&l#L | Perforation skip: 0 off, 1 on. |
Esc&k#H | Horizontal motion index, in 1/120 inch. |
Esc&l#C | Vertical motion index, in 1/48 inch. |
Esc&l#D | Line spacing in lines per inch: 1, 2, 3, 4, 6 (default), 8, 12, 16, 24 or 48; 0 is also accepted. |
Esc&k#G | Line termination: 0 CR=CR LF=LF FF=FF, 1 CR=CR+LF, 2 LF=CR+LF FF=CR+FF, 3 all three. |
Esc&s#C | End-of-line wrap: 0 on, 1 off. |
Esc*o#Q | † Print quality: −1 EconoFast, 0 normal, 1 best (presentation graphics). |
Cursor positioning
| Command | Meaning |
|---|---|
Esc&a#R, Esc&a#C | Vertical and horizontal position in rows and columns; a sign makes it relative. |
Esc&a#V, Esc&a#H | Vertical and horizontal position in decipoints. |
Esc*p#Y, Esc*p#X | Vertical and horizontal position in PCL units. |
Esc&f#S | Push (0) or pop (1) the cursor position, up to 20 deep. |
Fonts
A font is chosen by its characteristics, in priority order. (
sets the primary font and ) the secondary, with the same values.
| Command | Meaning and values |
|---|---|
Esc(#letter | Symbol set, such as Esc(8U Roman-8 (the default), Esc(0N ISO 8859-1 Latin 1, Esc(0U ISO 6 ASCII, Esc(1U Legal, Esc(10U PC-8, Esc(19U Windows 3.1 Latin 1, Esc(1F ISO 69 French, Esc(0Y 3 of 9 barcode. The full list is appendix C of the comparison guide. In font headers and the symbol set ID code the ID is packed as number × 32 + (letter code − 64), so 0U is 21. |
Esc(s#P | Spacing: 0 fixed, 1 proportional. |
Esc(s#H | Pitch, characters per inch (fixed fonts). |
Esc(s#V | Height in points (proportional fonts). |
Esc(s#S | Style, 0–32767, combining posture, width and structure. Common values (table 8-1): 0 upright solid, 1 italic, 4 condensed, 5 condensed italic, 8 compressed (extra condensed), 24 expanded, 32 outline, 64 inline, 128 shadowed, 160 outline shadowed. |
Esc(s#B | Stroke weight, −7 (ultra thin) to 7 (ultra black); 0 medium, 3 bold. |
Esc(s#T | Typeface number, such as 4099 Courier, 4101 CG Times, 4148 Univers, 16602 Arial, 16901 Times New Roman. |
Esc(#X | Select a font by its ID. |
Esc(3@ | Select the default font. |
Esc&d#D, Esc&d@ | Underline on (0 fixed, 3 floating), off. |
Esc&p#X | Transparent print data: the next # bytes are printed as characters. |
Esc&t#P | † Text parsing method: 0 or 1 every code is one byte; 21 bytes 0x21–0xFF start a two-byte character (JIS X 0208, GB 2312, KS C 5601 seven-bit); 31 bytes 0x81–0x9F and 0xE0–0xFC start one (Shift-JIS); 38 bytes 0x80–0xFF start one. |
Font and symbol set downloading
| Command | Meaning |
|---|---|
Esc*c#D | Font ID for the next font commands. |
Esc*c#E | Character code for the next character download. |
Esc*c#F | Font control: 0 delete all, 1 delete temporary, 2 delete font ID, 3 delete character, 4 make temporary, 5 make permanent, 6 copy the current font to the font ID. |
Esc)s#W | Font header: # bytes follow (bitmap, Intellifont or TrueType header, type given in its first bytes). |
Esc(s#W | Character descriptor and data: # bytes follow. |
Esc*c#R, Esc(f#W, Esc*c#S | Symbol set ID, user-defined symbol set data, symbol set control. |
Raster graphics
| Command | Meaning and values |
|---|---|
Esc*t#R | Raster resolution in dots per inch: 75 (default), 100, 150, 200, 300, 600; send before starting raster graphics. |
Esc*r#F | Presentation: 0 in the orientation of the logical page, 3 (default) along the width of the physical page. |
Esc*r#S, Esc*r#T | Source raster width and height, in pixels. |
Esc*t#H, Esc*t#V | Destination width and height in decipoints, for raster scaling (colour printers). |
Esc*r#A | Start raster graphics: 0 at the default left graphics margin (X = 0), 1 at the current cursor; 2 and 3 are the same with raster scaling on (colour printers). |
Esc*b#M | Compression: 0 unencoded, 1 run-length (count and byte pairs), 2 TIFF revision 4.0 (PackBits), 3 delta row, 5 adaptive (several rows in one block). Other values are ignored. |
Esc*b#W | Transfer raster data: # bytes of one row follow (or a block, with method 5). |
Esc*b#V | Transfer one plane of a row, # bytes, for planar colour data; the last plane of the row is sent with Esc*b#W. |
Esc*b#Y | Raster Y offset: move down # raster lines (0–32767), only in raster mode. |
Esc*rB, Esc*rC | End raster graphics. Esc*rC also zeroes the seed row, moves below the raster area, sets compression to 0 and the left graphics margin to 0. |
Rectangles, patterns and print model
| Command | Meaning and values |
|---|---|
Esc*c#A, Esc*c#B | Rectangle width and height in PCL units. |
Esc*c#H, Esc*c#V | Rectangle width and height in decipoints. |
Esc*c#G | Pattern (area fill) ID: for shading, a percentage 1–100 rendered in eight levels (1–2, 3–10, 11–20, 21–35, 36–55, 56–80, 81–99, 100); for cross-hatch, one of six predefined patterns 1–6; or the ID of a user-defined pattern. |
Esc*c#P | Fill the rectangle: 0 black, 1 white, 2 shading, 3 cross-hatch, 4 user pattern, 5 current pattern. |
Esc*v#T | Current pattern: 0 solid black, 1 solid white, 2 shading, 3 cross-hatch, 4 user-defined. |
Esc*v#N, Esc*v#O | Source transparency and pattern transparency: 0 transparent, 1 opaque. |
Esc*c#W | User-defined pattern: # bytes of pattern data follow. |
Esc*c#Q | Pattern control: 0 delete all, 1 delete temporary, 2 delete the last ID, 4 make it temporary, 5 make it permanent. |
Esc*p#R | Set the pattern reference point to the cursor: 0 patterns rotate with the print direction, 1 they stay fixed. |
Esc*l#O | Logical operation: a raster operation (ROP3) code 0–255 combining source, texture and destination; default 252 (TSo). |
Esc*l#R | Pixel placement: 0 grid intersection (default), 1 grid centred. |
Colour (PCL 5c)
| Command | Meaning and values |
|---|---|
Esc*r#U | Simple colour: 1 single-plane black palette (default), 3 three-plane device RGB palette, −3 three-plane device CMY palette. |
Esc*v#W | Configure image data: 6 bytes (short form) or more follow. Byte 0 colour space: 0 device RGB, 1 device CMY, 2 sRGB. Byte 1 pixel encoding: 0 indexed by plane (1–8 bits per index), 1 indexed by pixel (1, 2, 4 or 8), 2 direct by plane (1 bit per component), 3 direct by pixel (8 bits per component). Byte 2 bits per index; bytes 3–5 bits per component. |
Esc*v#A, Esc*v#B, Esc*v#C, Esc*v#I | Colour components 1, 2 and 3, then assign them to palette index #. |
Esc*v#S | Foreground colour: palette index. |
Esc*p#P | Push (0) or pop (1) the palette. |
Esc&p#S, Esc&p#I, Esc&p#C | Palette select, palette ID, palette control. |
Esc*t#J | Render algorithm: 0 continuous tone detail, 3 device best dither (default), 15 continuous tone smooth, 18 continuous tone basic, on HP colour LaserJets; other printers accept other ranges up to 19 (comparison guide). |
Esc*t#I, Esc*l#W, Esc*m#W | Gamma correction, colour lookup tables, download dither matrix. |
Macros
| Command | Meaning and values |
|---|---|
Esc&f#Y | Macro ID. |
Esc&f#X | Macro control: 0 start definition, 1 stop definition, 2 execute, 3 call, 4 enable overlay (run at the end of every page), 5 disable overlay, 6 delete all, 7 delete temporary, 8 delete macro ID, 9 make temporary, 10 make permanent. |
HP-GL/2 inside PCL
| Command | Meaning |
|---|---|
Esc*c#X, Esc*c#Y | Picture frame width and height, in decipoints (0–32767); setting them puts P1 and P2 at the frame’s corners. |
Esc*c0T | Set the picture frame anchor point to the cursor. |
Esc*c#K, Esc*c#L | HP-GL/2 plot horizontal and vertical size, in inches. |
Esc%#B | Enter HP-GL/2: 0 previous pen position, 1 current cursor. |
Esc%#A | Return to PCL from HP-GL/2: 0 cursor at the previous PCL position, 1 at the current HP-GL/2 pen position. Even values act as 0 and odd as 1, for both commands. |
Status readback and other commands
| Command | Meaning |
|---|---|
Esc*s#T, Esc*s#U, Esc*s#I, Esc*s#X, Esc*s#M | Status readback: location type (0 invalid, 1 currently selected, 2 all, 3 internal, 4 downloaded, 5 cartridge, 7 user-installable ROM), location unit, inquire entity (0 font, 1 macro, 2 user-defined pattern, 3 symbol set, 4 font extended), echo (−32767 to 32767, returned to the host), free space. |
Esc&r#F | Flush pages: 0 all complete pages, 1 all pages including a partial one. |
Esc&n#W | Alphanumeric ID: # bytes follow, an operation code and a string (media type names, for example). |
Sources
- HP, PCL 5 Printer Language Technical Reference Manual, parts I and II (HP part bpl13210 and bpl13211) – syntax, job, page, cursor, font, raster, macro, print model, picture frame and status readback commands
- HP, PCL 5 Comparison Guide (bpl13206) – feature support matrix, media type, print quality, text parsing, later paper sizes, sources and bins
- HP, PCL 5 Color Technical Reference Manual (bpl13212) – simple colour, configure image data, render algorithm, compression, raster scaling, logical operations