Note: This is an unofficial archive of a page which once existed at http://www.ajp.clara.net/hp.htm .
This page provides an unofficial guide to the basics of Hewlett-Packard Printer Command Language Level 3 with some extensions. PCL-3 will work with the majority of HP Deskjet printers manufactured within the last few years as well as certain other printers. If you are unsure whether PCL-3 will work with your printer, you can download a sample PCL file and copy it directly to your printer. The DOS command to achieve this is: copy /b test.prn prn: The Linux equivalent is typically: cp test.prn /dev/lp0
Hewlett-Packard can be found on the web at http://www.hp.com
if you require details of the range of products and services they offer including those in the area of printing and imaging. When compiling the following reference guide, I checked all commands using a HP Deskjet 320 printer which uses PCL-3 with extensions. You may get slightly different results or more command options on your printer, particularly with commands relating to typefaces and page margins.
PC World
Dabs.com
John LewisYou may also wish to browse the AJP Shop for more links to retailers based in the UK. I found a very good PCL Wizard on Hewlett-Packard's site a while ago, which allowed you to create simple PCL strings quickly and easily. It appears to have mysteriously disappeared, but please let me know if you find it elsewhere. HP's site also provides a list of the main PCL commands for DeskJet series and LaserJet series users. You may find this useful if you want to use a particular typeface, character set or paper size which I haven't listed in my guide.
A visitor of this site sent me a link to Developer's Guide to HP Printers which leaves my page rather redundant! The same visitor also sent me some C source code for compressing PCL graphics data. Thanks to Uwe for these.
Commands to enable colour printing are a useful extension of PCL. I hope to add colour printing information soon, after further investigation. In the meantime, you might want to consult some notes on colour printing for Pascal programmers instead.
Contents | ||
The following topic areas are discussed on this page. To jump to a specific topic, click on the link to that topic. Alternatively, you can read the whole document in order. The order in which I have chosen to describe the commands is not representative of the order in which they should be used, which will vary. This is not necessarily a complete list of commands, but you should be able to achieve everything you want to using them. Introduction |
Introduction | ||
Most of the characters which make up the PCL-3 commands are standard printable characters. There are some exceptions, most notably escape character 27 (1Bh) which all PCL-3 commands begin with. I will represent this character with the § character. To eliminate any ambiguity caused by different character sets, I will show all commands as a series of hexadecimal values within square brackets as well as printable characters. PCL commands follow a standard structure starting with the escape character.
After the escape character comes the command type, the command value and a terminator identifying the specific command.
An example of this is found in the font selection commands, all of which begin with §(s or [1B][28][73].
Commands of the same type can often be strung together without the need to include the command type bytes by changing the terminating character from upper to lower case.
For example, to choose a 12pt 10cpi font: In a lot of cases, I have only listed one example of a command. This is when it is clear what the command value represents. An example of this is font size selection. I have only listed §(s12V for 12pt, but clearly §(s6V is equally valid for 6pt. Consult your manual or hunt around for a full list of valid typeface and size combinations for your printer. |
Page Setup | ||
Select Page Orientation | ||
§&l0O | [1B][26][6C][30][4F] | Selects portrait orientation |
§&l1O | [1B][26][6C][31][4F] | Selects landscape orientation |
Select Line Termination Method | ||
§&k0G | [1B][26][6B][30][47] | Sets CR=CR LF=LF FF=FF |
§&k1G | [1B][26][6B][31][47] | Sets CR=CR-LF LF=LF FF=FF |
§&k2G | [1B][26][6B][32][47] | Sets CR=CR LF=CR-LF FF=CR-FF |
§&k3G | [1B][26][6B][33][47] | Sets CR=CR-LF LF=CR-LF FF=CR-FF |
Select EOL Wraparound | ||
§&s0C | [1B][26][73][30][43] | Enables EOL wraparound |
§&s1C | [1B][26][73][31][43] | Disables EOL wraparound |
Select Paper Size | ||
§&l0A | [1B][26][6C][30][41] | Selects default paper size |
§&l1A | [1B][26][6C][31][41] | Selects executive paper size |
§&l2A | [1B][26][6C][32][41] | Selects letter paper size |
§&l3A | [1B][26][6C][33][41] | Selects legal paper size |
§&l26A | [1B][26][6C][32][36][41] | Selects A4 paper size |
Set Page Margins | ||
§&a5L | [1B][26][61][35][4C] | Sets left margin to column 5 |
§&a70M | [1B][26][61][37][30][4D] | Sets right margin to column 70 |
§&l50P | [1B][26][6C][35][30][50] | Sets page length to 50 lines |
§&l2E | [1B][26][6C][32][45] | Sets top margin to 2 lines |
§&l42F | [1B][26][6C][34][32][46] | Sets text length to 42 lines |
Select Perforation Skip | ||
§&l0L | [1B][26][6C][30][4C] | Disables perforation skip |
§&l1L | [1B][26][6C][31][4C] | Enables perforation skip |
Select Print Quality | ||
§(s1Q | [1B][28][73][31][51] | Selects draft quality |
§(s2Q | [1B][28][73][32][51] | Selects letter quality |
|
Font Selection | ||
Select Character Set | ||
§(0U | [1B][28][30][55] | Selects ASCII character set |
§(10U | [1B][28][31][30][55] | Selects PC-8bit character set |
§(1E | [1B][28][31][45] | Selects ISO 4 UK character set |
§(0I | [1B][28][30][49] | Selects ISO 15 Italian character set |
§(2S | [1B][28][32][53] | Selects ISO 17 Spanish character set |
§(1G | [1B][28][31][47] | Selects ISO 21 German character set |
§(1F | [1B][28][31][46] | Selects ISO 69 French character set |
Select Typeface | ||
§(s3T | [1B][28][73][33][54] | Selects Courier font |
§(s6T | [1B][28][73][36][54] | Selects Letter Gothic font |
§(s4101T | [1B][28][73][34][31][30][31][54] | Selects CG Times font |
§(s52T | [1B][28][73][35][32][54] | Selects Univers font |
Select Font Pitch and Size | ||
§(s10H | [1B][28][73][31][30][48] | Selects 10cpi pitch |
§(s12V | [1B][28][73][31][32][56] | Selects 12pt size |
Select Character and Line Spacing | ||
§(s0P | [1B][28][73][30][50] | Selects monospacing |
§(s1P | [1B][28][73][31][50] | Selects proportional spacing |
§&l6D | [1B][26][6C][36][44] | Selects 6 lines per inch spacing |
|
Character Formatting | ||
Select Italics and Boldface | ||
§(s1S | [1B][28][73][31][53] | Begin Italics |
§(s0S | [1B][28][73][30][53] | End Italics |
§(s3B | [1B][28][73][33][42] | Begin Boldface |
§(s0B | [1B][28][73][30][42] | End Boldface |
Select Underline Styles | ||
§&d1D | [1B][26][64][31][44] | Select single fixed underline |
§&d2D | [1B][26][64][32][44] | Select double fixed underline |
§&d3D | [1B][26][64][33][44] | Select single floating underline |
§&d4D | [1B][26][64][34][44] | Select double floating underline |
§&d@ | [1B][26][64][40] | Turn off all underline |
§&k0E | [1B][26][6B][30][45] | Cancel underline at EOL |
§&k1E | [1B][26][6B][31][45] | Retain underline at EOL |
Select Superscript and Subscript | ||
§(s1U | [1B][28][73][31][55] | Begin superscript |
§(s-1U | [1B][28][73][2D][31][55] | Begin subscript |
§(s0U | [1B][28][73][30][55] | Resume normal print |
|
Moving Print Position | ||
Positioning by Row and Column | ||
§&a3R | [1B][26][61][33][52] | Move to row 3 |
§&a+2R | [1B][26][61][2B][32][52] | Move down 2 rows |
§&a9C | [1B][26][61][39][43] | Move to column 9 |
§&a+4C | [1B][26][61][2B][34][43] | Move right 4 columns |
§&a-6C | [1B][26][61][2D][36][43] | Move left 6 columns |
Positioning by Dot | ||
§*p80Y | [1B][2A][70][38][30][59] | Move to vertical dot position 80 |
§*p+20Y | [1B][2A][70][2B][32][30][59] | Move down by 20 dots |
§*p64X | [1B][2A][70][36][34][58] | Move to horizontal dot position 64 |
§*p+8X | [1B][2A][70][2B][38][58] | Move right by 8 dots |
§*p-6X | [1B][2A][70][2D][34][58] | Move left by 4 dots |
Positioning by Decipoint (1/720") | ||
§&a80V | [1B][26][61][38][30][56] | Move to vertical decipoint position 80 |
§&a+20V | [1B][26][61][2B][32][30][56] | Move down by 20 decipoints |
§&a64H | [1B][26][61][36][34][48] | Move to horizontal decipoint position 64 |
§&a+8H | [1B][26][61][2B][38][48] | Move right by 8 decipoints |
§&a-6H | [1B][26][61][2D][34][48] | Move left by 4 decipoints |
Additional Positioning | ||
Ctrl-H | [08] | Backspace |
Ctrl-I | [09] | Tab |
Ctrl-J | [0A] | Line feed (LF) |
§= | [1B][3D] | Half line feed |
Ctrl-L | [0C] | Form feed (FF) |
Ctrl-M | [0D] | Carriage Return (CR) |
|
Miscellaneous Commands | ||
§E | [1B][45] | Reset printer |
§z | [1B][7A] | Perform self test |
§Y | [1B][59] | Print control codes as characters |
§Z | [1B][5A] | Use control codes (resume) |
§&p3X | [1B][26][70][33][58] | Print next 3 bytes as characters |
|
Printing Raster Graphics | ||
Select Graphics Resolution | ||
§*t300R | [1B][2A][74][33][30][30][52] | Set resolution to 300dpi |
§*t150R | [1B][2A][74][31][35][30][52] | Set resolution to 150dpi |
§*t100R | [1B][2A][74][31][30][30][52] | Set resolution to 100dpi |
§*t75R | [1B][2A][74][37][35][52] | Set resolution to 75dpi |
Select Graphics Compression Mode | ||
§*b0M | [1B][2A][62][30][4D] | Select mode 0 |
§*b1M | [1B][2A][62][31][4D] | Select mode 1 |
§*b2M | [1B][2A][62][32][4D] | Select mode 2 |
Start Printing Graphics | ||
§*r0A | [1B][2A][72][30][41] | Start graphics at leftmost position |
§*r1A | [1B][2A][72][31][41] | Start graphics at current position |
Set Temporary Graphics Offset | ||
§*b80X | [1B][2A][62][38][30][58] | Offset current line by 80 dots |
Transfer Graphics Data | ||
§*b4W | [1B][2A][62][34][57] | Transfer 4 bytes of graphics data |
Finish Graphics | ||
§*rB | [1B][2A][52][42] | Return to text mode |
Typical Graphics Printing Procedure Graphics Compression Modes Graphics Mode 0 (No Compression) Graphics Mode 1 Graphics Mode 2 (TIFF Group 4 Compression) |
Web page design by Andrew J Payne (ajp@clara.net) - March 2002 |
![]() |