Based on http://itsa.ucsf.edu/~rpb/hppcl.html and information from http://www.csgnetwork.com/hppclhist.html with additional explanation and corrections by Lee Jones for <suppressed> project on 20 Sep 2004.
Hewlett-Packard Laser and DeskJet Printer Escape Code Sequences Collected and annotated by W.C. Parke, 1991. Edited and converted to html by R.P. Bagnall, 1996.
These Hewlett-Packard escape sequences are also known as HPPCL, HP Printer Command Language. This document reflects PCL 5 (the 5th revision to HP PCL command set).
HP provides 4 general types of commands to control the printer. They are single control characters, PCL escape sequences, HP-GL/2 vector graphics (not covered in this document), and PJL commands.
Parameterized escape sequences then have one or more single character action verb(s). Upper case and lower case characters have equivalent meaning as an action descriptor. Each action verb character triggers a specific function (see table below).
Each action verb may, optionally, be preceded by a numeric value field. The value field normally consists entirely of decimal digits range 48 to 57 decimal ( ASCII "0123456789" ). It may have a leading "+" or "-" sign character. If a decimal fraction is included, the field may contain one embedded decimal point character ( ASCII "." ). If the value field is not present, default of 0 is used.
The value field is normally represented by a # character in HP documentation and in the table below.
Parameterized escape sequences are terminated by the occurance of an upper case ASCII character, i.e. a byte in range 64..94 decimal ( ASCII "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^" ).
Multiple parameterized escape sequences in the same group (i.e. which have the same second and third bytes) may be combined. First and intermediate action verbs are lower case (range 96..126 decimal). The final action verb must be upper case (range 64..94 decimal).
For example, to set the horizontal margins to columns 4 and 76, the following can be used:
<esc>&a4L
<esc>&a76M
They can be combined into a single sequence of:
<esc>&a4l76M (where l is lower case el character)
Here's another example of equivalent commands. To move the cursor to row 13 column 25, use one of the following:
<esc>&a13R
<esc>&a25C
or:
<esc>&a13r25C
or:
<esc>&a25c13R
Some parameterized escape sequences are followed by a counted number of arbitrary data octets. The {data} field follows the terminating action verb. Length of {data} is specified in the value field. The content of the {data} field is ignored (i.e. not interpreted as PCL commands).
HPPCL, sorted by group code byte and terminating action verb
<esc>&a#C Cursor Horizontal Position - Columns <esc>&a0G Page Side Selection Next Side <esc>&a1G Page Side Selection Front Side <esc>&a2G Page Side Selection Back Side <esc>&a#H Cursor Horizontal Position - Decipoints <esc>&a#L Job Margin Left column # <esc>&a#M Job Margin Right column # <esc>&a#P Job Character Rotate #x (X=0,90,180, or 270) <esc>&a#R Cursor Vertical Position - Rows <esc>&a#V Cursor Vertical Position - Decipoints <esc>&d@ Font Underline Off <esc>&dD Font Underline Enable <esc>&d0D Font Underline Enable Fixed <esc>&d1D Font Underline Single Fixed <esc>&d2D Font Underline Double Fixed <esc>&d3D Font Underline Single Float <esc>&d4D Font Underline Double Float <esc>&f0S Macro Cursor Push position <esc>&f1S Macro Cursor Pop position <esc>&f0X Macro Start Definition <esc>&f1X Macro Stop Definition <esc>&f2X Macro Execute <esc>&f3X Macro Call <esc>&f4X Macro Enable Overlay # <esc>&f5X Macro Disable Overlay # <esc>&f6X Macro Delete All <esc>&f7X Macro Delete All Temp <esc>&f8X Macro Delete One Macro # <esc>&f9X Macro Make Temp <esc>&f10X Macro Make Permanent <esc>&f#Y Macro Set New ID # <esc>&k0E Job Line-by-Line Enhance ON <esc>&k1E Job Line-by-Line Enhance OFF <esc>&k0F Job Line-by-LIne SI/SO ON <esc>&k1F Job Line-by-Line SI/SO OFF <esc>&k0G Job Line Termination Normal <esc>&k1G Job Line Termination CR=CR+LF <esc>&k2G Job Line Termination LF=FF=CR+LF <esc>&k3G Job Line Termination CR=LF=FF=CR+LF <esc>&k#H Cursor Horizontal Motion Index #/120" incr. <esc>&k0S Font Pitch 10.00 <esc>&k2S Font Pitch 16.66 <esc>&k0W Job Print Left to Right <esc>&k1W Job Print Bidirectional <esc>&k2W Job Print Right to Left <esc>&k5W Job Print Text Scale OFF <esc>&k6W Job Print Text Scale ON <esc>&l0A Job Paper Default size <esc>&l1A Job Paper Size Executive <esc>&l2A Job Paper Size Letter <esc>&l3A Job Paper Size Legal <esc>&l26A Job Paper Size A4 <esc>&l80A Job Paper Size Monarch <esc>&l81A Job Paper Size Commercial #10 envelope <esc>&l90A Job Paper Size International DL envelope <esc>&l91A Job Paper Size International C5 envelope <esc>&l#C Cursor Vertical Motion Index #/48" incr. <esc>&l#D Cursor Lines per inch # (1,2,3,4,6,8,12,16,24,48) <esc>&l#E Job Margin Top # of lines <esc>&l#F Job Margin Text Length # of lines <esc>&l1G Job Paper Destination Upper Bin <esc>&l2G Job Paper Destination Rear Bin <esc>&l0H Job Paper Page Eject <esc>&l1H Job Paper Source from Upper Tray <esc>&l2H Job Paper Input Manual Feed from Tray <esc>&l3H Job Paper Input Manual Feed Envelope <esc>&l4H Job Paper Source from Lower Tray <esc>&l6H Job Paper Envelope Feeder <esc>&l0L Job Paper Perf Skip Off <esc>&l1L Job Paper Perf Skip On <esc>&l0O Job Page Orientation Portrait <esc>&l1O Job Page Orientation Landscape <esc>&l2O Job Page Orientation Reverse Portrait <esc>&l3O Job Page Orientation Reverse Landscape <esc>&l#P Job Page Length # of lines <esc>&l0S Job Page Simplex <esc>&l1S Job Page Duplex Long-Edge Binding <esc>&l2S Job Page Duplex Short-Edge Binding <esc>&l1T Job Separation <esc>&l#U Job Margin Left Offset # in 1/720 inches <esc>&l#X Job Paper Number of Copies (ESC,ESC,&l#X) <esc>&l#Z Job Margin Top Offset # in 1/720 inches <esc>&p#X{data} Job Print Data Transparent #bytes <esc>&s0C Cursor Line Wrap On <esc>&s1C Cursor Line Wrap Off <esc>(#@ Font Primary Default ID # <esc>(0@ Font Primary Default CharSet <esc>(2@ Font Primary Current CharSet <esc>(3@ Font Primary Default Active <esc>(0A Font Primary Math Symbol set <esc>(0B Font Primary Line Draw Symbol set <esc>(0D Font Primary ISO 60: Norway v.1 <esc>(1D Font Primary ISO 61: Norway v.2 <esc>(0E Font Primary HP Roman Extension <esc>(1E Font Primary ISO UK <esc>(0F Font Primary ISO 25: French <esc>(1F Font Primary ISO 69: France <esc>(0G Font Primary HP German <esc>(1G Font Primary ISO 21: Germany <esc>(8G Font Primary ISO HP Greek8 <esc>(0I Font Primary ISO 15: Italy <esc>(6J Font Primary Microsoft Publishing <esc>(7J Font Primary DeskTop <esc>(10J Font Primary PS Text <esc>(13J Font Primary Ventura International <esc>(14J Font Primary Ventura US <esc>(0K Font Primary ISO 14: JIS ASCII <esc>(1K Font Primary ISO HP Katakana <esc>(2K Font Primary ISO 57: Chinese <esc>(8K Font Primary Kana-8 Symbol set <esc>(0L Font Primary JIS Line Draw <esc>(10L Font Primary PS ITC Zapf Dingbats <esc>(11L Font Primary ITC Zapf Dingbats Series 100 <esc>(12L Font Primary ITC Zapf Dingbats Series 200 <esc>(13L Font Primary ITC Zapf Dingbats Series 300 <esc>(0M Font Primary JIS Math7 <esc>(1M Font Primary Technical <esc>(5M Font Primary Technical PS Math <esc>(6M Font Primary Technical Ventura Math <esc>(8M Font Primary JIS Math8 <esc>(0N Font Primary ISO100: ECMA-94 Latin 1 <esc>(0O Font Primary OCR-A <esc>(1O Font Primary OCR-B <esc>(0Q Font Primary JIS Math8a <esc>(1Q Font Primary JIS Math8b <esc>(2Q Font Primary JIS PIFonta <esc>(0S Font Primary ISO 11: Swedish <esc>(1S Font Primary HP Spanish <esc>(2S Font Primary ISO 17: Spain <esc>(3S Font Primary ISO 10: Sweden: Names <esc>(4S Font Primary ISO 16: Portugal <esc>(5S Font Primary ISO 84: Portugal <esc>(6S Font Primary ISO 85: Spanish <esc>(0U Font Primary ISO 6: ASCII <esc>(1U Font Primary JIS Legal <esc>(2U Font Primary ISO 2: IRV <esc>(7U Font Primary OEM-1 <esc>(8U Font Primary Roman 8 Symbol set <esc>(9U Font Primary ANSI Symbol set <esc>(10U Font Primary PC-8 symbol set <esc>(11U Font Primary PC-8 Denmark/Norway <esc>(12U Font Primary PC-8 50 <esc>(15U Font Primary JIS Pi Font <esc>(#X Font Primary Download Select ID # <esc>(s0B Font Primary Stroke Weight Normal <esc>(s-7B Primary Font Stroke Weight Ultra Thin <esc>(s-6B Primary Font Stroke Weight Extra Thin <esc>(s-5B Primary Font Stroke Weight Thin <esc>(s-4B Primary Font Stroke Weight Extra Light <esc>(s-3B Primary Font Stroke Weight Light <esc>(s-2B Primary Font Stroke Weight Demi Light <esc>(s-1B Primary Font Stroke Weight Semi Light <esc>(s0B Primary Font Stroke Weight Medium (book or text) <esc>(s1B Primary Font Stroke Weight Semi Bold <esc>(s2B Primary Font Stroke Weight Demi Bold <esc>(s3B Primary Font Stroke Weight Bold <esc>(s4B Primary Font Stroke Weight Extra Bold <esc>(s5B Primary Font Stroke Weight Black <esc>(s6B Primary Font Stroke Weight Extra Black <esc>(s7B Primary Font Stroke Weight Ultra Black <esc>(s#H Font Primary Pitch (10,12,16.66) <esc>(s0P Font Primary Spacing Fixed <esc>(s1P Font Primary Spacing Proportional <esc>(s1Q Font Primary Draft Quality <esc>(s2Q Font Primary Letter Quality <esc>(s0S Font Primary Type Style: Upright <esc>(s1S Font Primary Style Italic <esc>(s4S Font Primary Style Condensed <esc>(s5S Font Primary Style Condensed Italic <esc>(s8S Font Primary Style Compressed (Extra Condensed) <esc>(s24S Font Primary Style Expanded <esc>(s32S Font Primary Style Outline <esc>(s64S Font Primary Style Inline <esc>(s128S Font Primary Style Shadowed <esc>(s160S Font Primary Style Sutline Shadowed <esc>(s#T Font Primary Typeface CG Times (#= 4101) <esc>(s#T Font Primary Typeface Univers (#= 4148) <esc>(s0T Font Primary Typeface Line Printer <esc>(s1T Font Primary Typeface Pica <esc>(s2T Font Primary Typeface Elite <esc>(s3T Font Primary Typeface Courier <esc>(s4T Font Primary Typeface Helvetica <esc>(s5T Font Primary Typeface Times Roman <esc>(s6T Font Primary Typeface Gothic <esc>(s7T Font Primary Typeface Script <esc>(s8T Font Primary Typeface Prestige <esc>(s11T Font Primary Typeface Presentations <esc>(s17T Font Primary Typeface Optima <esc>(s18T Font Primary Typeface ITC Garamond <esc>(s19T Font Primary Typeface Cooper Black <esc>(s20T Font Primary Typeface Coronet Bold <esc>(s21T Font Primary Typeface Broadway <esc>(s22T Font Primary Typeface Bodini Condensed <esc>(s23T Font Primary Typeface Century School <esc>(s24T Font Primary University Roman <esc>(s32T Font Primary Typeface Brush <esc>(s61T Font Primary Typeface Dom Casual <esc>(s85T Font Primary Typeface Univers Conden. <esc>(s0U Font Primary Typeface Normal <esc>(s+1U Font Primary Super <esc>(s-1U Font Primary Sub <esc>(s#V Font Primary Character Height # of 1/72" <esc>(s#W{data} Font Download Character # Bytes <esc>)#@ Font Secondary Default ID # <esc>)0@ Font Secondary Default CharSet <esc>)2@ Font Secondary Current CharSet <esc>)2@ Font Secondary Current CharSet <esc>)3@ Font Secondary Default Active <esc>)0A Font Secondary Math Symbol set <esc>)0B Font Secondary Line Draw Symbol set <esc>)0D Font Secondary ISO Norway v.1 <esc>)1D Font Secondary ISO Norway v.2 <esc>)0E Font Secondary HP Roman Extension <esc>)1E Font Secondary ISO UK <esc>)0F Font Secondary ISO 25: French <esc>)1F Font Secondary ISO 69: France <esc>)0G Font Secondary HP German <esc>)1G Font Secondary ISO 21: Germany <esc>)8G Font Secondary HP Greek8 <esc>)0I Font Secondary ISO Italy <esc>)0K Font Secondary JIS ASCII <esc>)1K Font Secondary HP Katakana <esc>)2K Font Secondary ISO 57: Chinese <esc>)8K Font Secondary Kana-8 Symbol set <esc>)0L Font Secondary JIS Line Draw <esc>)0M Font Secondary JIS Math7 <esc>)1M Font Secondary Technical <esc>)8M Font Secondary JIS Math8 <esc>)0N Font Secondary ECMA-94 Latin 1 <esc>)0O Font Secondary OCR-A <esc>)1O Font Secondary OCR-B <esc>)0Q Font Secondary JIS Math8a <esc>)1Q Font Secondary JIS Math8b <esc>)2Q Font Secondary JIS PIFonta <esc>)0S Font Secondary ISO 11: Swedish <esc>)1S Font Secondary HP Spanish <esc>)2S Font Secondary ISO Spain <esc>)3S Font Secondary ISO Sweden: Names <esc>)4S Font Secondary ISO Portugal <esc>)5S Font Secondary ISO 84: Portuguese <esc>)6S Font Secondary ISO 85: Spanish <esc>)0U Font Secondary ISO 6: ASCII <esc>)1U Font Secondary JIS Legal <esc>)2U Font Secondary ISO IRV <esc>)7U Font Secondary OEM-1 <esc>)8U Font Secondary Roman 8 Symbol set <esc>)9U Font Secondary ANSI Symbol set <esc>)10U Font Secondary PC-8 symbol set <esc>)11U Font Secondary PC-8 Denmark/Norway <esc>)12U Font Secondary PC-850 <esc>)15U Font Secondary JIS PIFont <esc>)#X Font Secondary Download Select ID # <esc>)s0B Font Secondary Stroke Weight Normal <esc>)s3B Font Secondary Stroke Weight Bold <esc>)s7B Font Secondary Stroke Weight Extra Bold <esc>)s-3B Font Secondary Light <esc>)s#H Font Secondary Pitch )10,12,16.66) <esc>)s0P Font Secondary Spacing Fixed <esc>)s1P Font Secondary Spacing Proportional <esc>)s1Q Font Secondary Draft Quality <esc>)s2Q Font Secondary Letter Quality <esc>)s0S Font Secondary Type Style: Upright <esc>)s1S Font Secondary Style Italic <esc>)s#T Font Secondary Typeface CG Times (#= 4101) <esc>)s#T Font Secondary Typeface Univers (#= 4148) <esc>)s0T Font Secondary Typeface Line Printer <esc>)s1T Font Secondary Typeface Pica <esc>)s2T Font Secondary Typeface Elite <esc>)s3T Font Secondary Typeface Courier <esc>)s4T Font Secondary Typeface Helvetica <esc>)s5T Font Secondary Typeface Times Roman <esc>)s6T Font Secondary Typeface Gothic <esc>)s7T Font Secondary Typeface Script <esc>)s8T Font Secondary Typeface Prestige <esc>)s11T Font Secondary Typeface Presentations <esc>)s17T Font Secondary Typeface Optima <esc>)s18T Font Secondary Typeface ITC Garamond <esc>)s19T Font Secondary Typeface Cooper Black <esc>)s20T Font Secondary Typeface Coronet Bold <esc>)s21T Font Secondary Typeface Broadway <esc>)s22T Font Secondary Typeface Bodini Condensed <esc>)s23T Font Secondary Typeface Century Schoolbook <esc>)s24T Font Secondary Typeface University Roman <esc>)s32T Font Secondary Typeface Brush <esc>)s61T Font Secondary Typeface Dom Casual <esc>)s85T Font Secondary Typeface Univers Conden. <esc>)s0U Font Secondary Typeface Normal <esc>)s+1U Font Secondary Super <esc>)s-1U Font Secondary Sub <esc>)s#V Font Secondary Character Height # of 1/72" <esc>)s#W{data} Font Download Create Font Header # Bytes <esc>*b0M Graphics Compaction OFF <esc>*b1M Graphics Compaction Mode 1 <esc>*b2M Graphics Compaction Mode 2 <esc>*b3M Graphics Compaction Delta Row <esc>*b#W{data} Graphics Transfer # Bytes <esc>*b#X Graphics X Offset # dots <esc>*b#Y Graphics Y Offset # dots <esc>*c#A Graphics Rectangle Horizontal Size-Dots <esc>*c#B Graphics Rectangle Vertical Size-Dots <esc>*c#D Font Download Assign ID # <esc>*c#E Font Download ASCII Code # <esc>*c0F Font Download Delete All <esc>*c1F Font Download Delete Temp <esc>*c2F Font Download Delete Last <esc>*c4F Font Download Make Temp <esc>*c5F Font Download Make Perm <esc>*c6F Font Assign Current as Temp <esc>*c#G Rectangle Shade 2,10,15,30,45,70,90,100% <esc>*c1G Rectangle Pattern Horizontal Lines <esc>*c2G Rectangle Pattern Vertical Lines <esc>*c3G Rectangle Pattern Diagonal + Lines <esc>*c4G Rectangle Pattern Diagonal - Lines <esc>*c5G Rectangle Pattern Square Lines <esc>*c6G Rectangle Pattern Crosshatch Lines <esc>*c#H Rectangle Size Horizontal Decipoints <esc>*c#K HPCL Plot Horizontal Size <esc>*c#L HPCL Plot Vertical Size <esc>*c0P Rectangle Fill Black <esc>*c1P Rectangle Fill White (IIP-III) <esc>*c2P Rectangle Fill Shading <esc>*c3P Rectangle Fill Pattern <esc>*c5P Rectangle Fill Current Pattern <esc>*c0T Set Picture Frame Anchor to cursor position <esc>*c#V Rectangle Size Vertical Decipoints <esc>*p#X Cursor Horizontal Position - Dots <esc>*p#Y Cursor Vertical Position - Dots <esc>*r0A Graphics Start Left Margin <esc>*r1A Graphics Start Current Cursor <esc>*rB Graphics End <esc>*r0F Graphics Presentation Rotate Image <esc>*r3F Graphics Laserjet Landscape Compatible <esc>*rK Job Printer Model Number Return <esc>*r0Q Graphics Set to default <esc>*r1Q Graphics Set Quality draft <esc>*r2Q Graphics Set to high <esc>*r#S Graphics Width # pixels <esc>*r#T Graphics Raster Height in raster rows <esc>*t#R Graphic Resolution # pixels/inch (#=75,100,150, or 300) <esc>*v0N Job Print Source Transparent <esc>*v1N Job Print Source Opaque <esc>*v0O Job Print Pattern Transparent <esc>*v1O Job Print Pattern Opaque <esc>*v0T Job Print Pattern - Black <esc>*v1T Job Print Pattern - White <esc>*v2T Job Print Pattern - Shading <esc>*v3T Job Print Pattern - Cross Hatch <esc>%0A Enter PCL Mode using prior PCL cursor position <esc>%1A Enter PCL Mode using current HPGL position <esc>%0B Enter HPGL Mode using prior HPGL cursor position <esc>%1B Enter HPGL Mode using current PCL position <esc>9 Job Margin Clear Horizontal <esc>= Cursor Half Line Feed <esc>E Job Printer Reset <esc>Y Job Display Function On <esc>z Job Printer Self-Test <esc>Z Job Display Function Off
Okidata printer configuration appears to be ASCII commands bracketed between special lead-in and trailer sequences. Note that they adhere to the general format of HP PCL parameterized escape sequences.
<esc>%-12345X@PJL lead-in for Okidata printer configuration
<esc>%-12345X trailer after Okidata printer configuration
Turns out that the <esc>%-12345X is defined by HP as part of PJL (Printer Job Language). It provides control of per-job elements and allows setting printer configuration (either defaults using the DEFAULT keyword or immediate change using the SET keyword).
<esc>%-12345X is the Universal Exit Language (UEL) command. It is immediately followed by @PJL (no intervening characters) then a single PJL command or a linefeed to enter multi-line PJL mode.Each line in multi-line mode must begin with the @PJL<sp> string.
Okidata supports standard HP commands to set common variables.They seem to have extended it with additional Okidata-specific variables that have an OKI prefix.
See:
Questions:
Comments:
Hi Lee,James Newton of Massmind replies: I would recommend selecting the font via the font selection string as listed on the PCL typeface list. That removes any issues with the source of the font and works reliably in my experience.
Your page contains the most info I have been able to find regarding secondary font commands, including HP sites, that I have purused. Thank you!
Even though, I am still searching for a method to fix a problem. Maybe you can help.
I have an erp system that print to pcl5e capable printers. We use only HP printers. Let me tell you what happens and how they do things...
Each printer has a "barcodes and more" dimm installed in it. To get barcodes to print from the erp system, we go into the printer configuration, and under pcl, select the dimm slot and the appropriate barcode font to print. (slot 4, id 16)
The erp system sends text as usual, up to the point it wants to print a barcode. Then it sends an escSO (chr(27)chr(14)), followed by the text to be barcoded, followed by an escSI (chr(27)chr(15)). The barcodes print as advertised. Apparently selecting the pcl font source and font id thru the front panel tells the printer that this font is the 'secondary' font. When the escSO command is sent, it shifts to this secondary font, prints the text using the secondary font, then shifts back to the primary. So far, so good.
Now we have a downloadable barcode font. We download the font to the printer, and give it a font ID of 18. It appears in the pcl font listing as a HP PCL5e Permanent Soft Font, Font # SOFT 4, Font ID 18. In testing we send the command esc)18X, which is supposed to tell the printer that font 18 is the secondary font. Then we send and escSO, followed by some text to print as a barcode, then an escSI to shift back to the primary font. What appears to happen is that the text prints using the 'internal' font 18, instead of the soft font 18.
I have tried using various combinations of esc)18X and esc)18@, but am getting nowhere. Maybe there is a command that tells the printer to use a "soft font" rather than an "Internal" font.
If you have a chance, and this is something you have knowledge about, please let me know what you know.
Thanx very much in advance.
ron