PCL 5

Hewlett-Packard created the PCL printer command language to provide an economical and efficient way for application programs to control a range of printer features across a number of printing devices. HP has evolved both the definition and implementations of the PCL printer language to provide the optimal price and performance balance. PostScript, which does allow more graphic effects, imposes a daunting price in elaborate computing hardware and slow speed. ASCII, while fast, does not allow even basic forms elements to be represented. PCL 5 represents a new breakthrough in price/performance leadership, with features selected in direct response to customer requests.

The PCL printer language commands are compact codes (preceded by a special character called the escape character which tells the printer to interpret them as commands rather than data to be printed) that are embedded in the print-job data stream. This approach minimizes both data transmission and computing overhead.

When entering or discussing PCL codes, be aware that the commands are case-sensitive (lower-case and upper-case letters are NOT equivalent as they are in DOS commands) and be sure to distinguish between such character pairs as the lower-case letter l and the digit 1 (one) or the upper-case letter O and the digit 0 (zero.) Because the PCL language is so extremely compact, it has no redundant elements and does not tolerate errors.

Control Codes - Single characters

Carriage Return

This control code causes the printer to reset the printing position to the left margin of the current page.

Line Feed

This control code causes the printer to advance to the next line as defined by the lines-per-inch setting. Many older computer systems automatically send this code at the end of each print line. Some computer systems count the number of line feeds that have been issued and inject a Form Feed after a certain set number, assuming that the printhead has arrived at the bottom of the form. This procedure can cause problems with pagination in lasers or inkjets, since the printable page length in these printers is different from that of the older impact printers. Also, since these older computers do not recognize printhead positioning commands often used with laser printers, it is possible to have printed many more Line Feeds than would normally be possible and still be on the same page.

Form Feed

This code ejects the current page from the printer. If a macro has been enabled for overlay using the esc4X PCL command, the form will be added to the page after receiving the Form Feed code but before the page is actually ejected. The PCL command esc&l0H can also be used to eject a page.

Escape

This special code, often written esc or <Esc>,  identifies the beginning of a PCL command.

Commands

Commands ("escape sequenmces") consist of two or more characters. The first character is always the ASCII escape character, identified by the esc symbol. esc is a special control code which identifies the subsequent string of characters as a printer command. As the printer monitors incoming data from a computer, it is "looking" for this character. When this character appears, the printer reads it and its associated characters as a command to be performed and not as data to be printed.

Two-Character

Two-character escape sequences consist of the escape character and one capital letter. For example:

escE

will reset the printer.

Parameterized

Parameterized escape sequences have the following form:

esc X y # Z

 where

X is the Parameterized Character, which can be one of: ! " # $ % & ' ( ) * + , - . / (each of these characters represents one family of commands.) For example, the ( character is associated with commands that control font selection.

y is the Group Character, which can be any lower-case letter from a to z or one of { | } ~ (each of these characters specifies the group of command in the current family.) For example, if the parameterized character is & representing control commands, then the l group character would indicate a job control command, and a f group character would indicate a macro control command.

# is the Value Field, a positive or negative number optionally including a fractional portion.

Z is the Parameter Character, which completes the PCL command. For example esc&l 8D sets the line spacing to 8 lines per inch. Several value fields and parameter characters can be repeated in one command if they are all from the same group specified by the parameterized character and the group character, by changing all but the last parameter character to lower-case. For example esc&f123y4X specifies that macro number 123 will be used AND that it is to be overlaid when the page is ejected.

HP-GL/2

HP-GL/2 codes are vector-graphic commands which cause the laser printer to function a plotter. These commands can be recorded in a macro only on the HP LaserJet 4 and above.

See also:

Questions: