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 E | total reset, ensures a known state on all LaserJets |
Esc Z | disable display functions |
Esc &l1L | skip on perforation, that is lower case L then numeral 1 |
Esc (3B | select bold for current font |
Esc (s1S | select italic for current font |
Esc (s0S | select upright for current font |