[Robelle] [SmugBook] [Index] [Prev] [Next]

LaserJets Speak PCL

Low-cost LaserJet and DeskJet printers from Hewlett-Packard have revolutionized the quality of printed documentation. The language they speak is PCL (Printer Control Language). There is a competing printer language called Postscript that the latest HP printers now speak. At Robelle we have used LaserJets extensively since the introduction of the original 2686A LaserJet in 1984.

The PCL command is recognized by the LaserJet by the presence of an Escape character (unprintable control character, ASCII value 27). The remaining characters are almost always printing characters, with the first selecting a group of related commands. You can combine Escape sequences from the same family by making all the options lower case except the last. For example, ESC &l40f15L specifies 40 lines of text (40f) and 15 columns for the left margin (15L) with the final L in caps.

Writing PCL code is somewhat like programming into a black hole. It is easy to write Escape sequences that appear to do something, but that don't actually do anything. The printer politely ignores any syntax errors without telling you about them. PCL often uses parameters of 0 and 1 to set a state Off or On, but the letters O and l look very similar. The trickiest PCL command to debug is the the page layout command, since it uses a lower case L (ell) as one of the parameters. For example,

    Esc &l1O   selects Landscape {small difference in syntax}
    Esc &l0O   selects Portrait  {big difference in result}

Just remember that a letter always follows an &, not the number 1, and the last thing is usually un upper case letter, not the number 0. Here are a few of our favorite PCL escape sequences:

Esc Etotal reset, ensures a known state on all LaserJets
Esc Zdisable display functions
Esc &l1Lskip on perforation, that is lower case L then numeral 1
Esc (3Bselect bold for current font
Esc (s1Sselect italic for current font
Esc (s0Sselect upright for current font


[Robelle] [SmugBook] [Index] [Misc] [Prev] [Next]