Control Codes

This section provides examples of commands that can be used to create bar codes.

PCL Escape Sequences

The escape sequence controls the character strings (Hexa: 1B or Dec: 27) that begin with <Esc>. By embedding and sending these character strings to this Bar Code Printing function in an unprintable, special character code, you can control details, such as the bar code size, as well as the caption text font and the space between the characters.
The following is an example of a valid PCL escape sequence:
<Esc>(s4p102h40v10,30b10,30s24670T
s4p:
Readable text that is located under the bars, without start or stop characters (*)
102h:
Caption text in Univers Regular
40v:
Bar height:
40 points
Formula:
40/72 = 0.555"
40*2.54/72 = 1.41 cm
10,30b:
Thin bars that are 10 dots wide, and thick bars that are 30 dots wide
10,30s:
Thin spaces that are 10 dots wide, and thick spaces that are 30 dots wide
24670T:
Symbol: code 39

Bar Code Rotation Codes

To rotate a bar code, you can use regular PCL rotation commands. We recommend that you save the cursor position before activating the bar code, and restore the original cursor position after the bar code is rotated.
Example: (Sequences should be entered without carriage returns.)
<Esc>&fS
Saves the cursor position.
<Esc>&a1000h1000V
Positions the cursor.
<Esc>&a90P
Rotates the bar code 90°.
<Esc>(s4p102h40v10,30b10,30s24670T
Formats the bar code.
CANON
The bar code text data.
<Esc>(10U<Esc>(sp10hsb4099T
Switches back to Courier 10 cpi font.
<Esc>&aP
Stops the rotation.
<Esc>&lf1S
Restores the original cursor position.

Font Switching

You can switch primary and secondary fonts with bar code fonts. We recommend that a text font be used as the primary font, and a bar code font be used as the secondary font.
IMPORTANT
Bar codes are not PCL fonts, even if they are generated using a PCL font sequence. Therefore, the following font sequence limitations apply:
No font ID can be linked to a bar code
Bar codes cannot be used with HP-GL2, PostScript, or PCL XL languages

OCR-A and OCR-B Fonts

The following PCL escape sequences enable OCR-A and OCR-B fonts:
OCR-A:
<Esc>(0O<Esc>(sp10h12vsb104T
OCR-B:
<Esc>(1O<Esc>(sp10h12vsb110T
The above table shows the OCR-A character set.

FreeScape Codes

PCL codes always begin with the unprintable escape code Hexa: 1B or Dec: 27. Some systems cannot use or send binary data to a device, which can represent a problem when using the PCL language with bar codes. An example of this kind of system is a mainframe computer with printers connected to terminals. To avoid conflicts between the PCL language and bar codes in such a system, the FreeScape Code, a user-defined Escape Code or AEC (Alternate Escape Code) can be specified.
FreeScape acts exactly like the standard escape code when it is located at the beginning of a regular PCL font sequence. The default value for the AEC is a '~' (tilde). FreeScape ignores the AEC if it is determined to be pure data. You can also mix escape codes and alternate escape codes.
The AEC can be any one of the following 10 characters:
", #, $, /, \, ?, {, }, |, ~.
The PCL font sequence to change to the alternate escape code is as follows:
<Esc or AEC>**#J
# represents the ASCII decimal value of the new AEC or ESC. Values for AEC are 34 ("), 35 (#), 36 ($), 47 (/), 92 (\), 63 (?), 123 ({), 125 (}), 124 (|), or 126 (~). The value for ESC is 27. If you indicate 27, it disables the FreeScape Code.
IMPORTANT
The FreeScape escape sequence setting is only valid for the current job.
The FreeScape Code can be enabled, disabled, or set as a parameter for all jobs from the FreeScape menu in Printer Settings (from the Settings/Registration screen).
When FreeScape is disabled, only the escape code (Hexa: 1B or Dec: 27) can be used to start PCL commands.
52SK-1SX