Zebra QLn320 Mobile Printer CPCL for Link-OS™ Enabled Printers

P1073699-001 Rev. A
CPCL
Programming Guide
for
Link-OS™-Enabled Printers
Copyright and Liability Disclaimer
2
© 2014 ZIH Corp. The copyrights in this manual and the software and/or firmware in the printer described therein are owned
®
This product may contain ZPL Imaging fonts. Software © ZIH Corp. All rights reserved worldwide.
, ZPL II®, and Link-OS™ programs; Element Energy Equalizer™ Circuit; E3™; and Monotype
Zebra, the Zebra head graphic, CPCL, Link-OS, ZPL, and ZPL II , are trademarks of ZIH Corp., registered in many jurisdictions worldwide. All rights reserved.
holders. For additional trademark information, please see “Trademarks” on the product CD.
Proprietary Statement This manual contains proprietary information of Zebra Technologies Corporation and its subsidiaries (“Zebra Technologies”). It is intended solely for the information and use of parties operating and maintaining the equipment described herein. Such proprietary information may not be used, reproduced, or disclosed to any other parties for any other purpose without the express, written permission of Zebra Technologies.
Product Improvements Continuous improvement of products is a policy of Zebra Technologies. All specifications and designs are subject to change without notice.
Liability Disclaimer Zebra Technologies takes steps to ensure that its published Engineering specifications and manuals are correct; however, errors do occur. Zebra Technologies reserves the right to correct any such errors and disclaims liability resulting therefrom.
All other brand names, product names, or trademarks belong to their respective
Limitation of Liability In no event shall Zebra Technologies or anyone else involved in the creation, production, or delivery of the accompanying product (including hardware and software) be liable for any damages whatsoever (including, without limitation, consequential damages including loss of business profits, business interruption, or loss of business information) arising out of the use of, the results of use of, or inability to use such product, even if Zebra Technologies has been advised of the possibility of such damages. Some jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so the above limitation or exclusion may not apply to you.
CPCL FOR LINK-OS PRINTERS
Page 2 of 329
1073699-001
TABLE OF CONTENTS
1 DESCRIPTION 11
1.1 Purpose 11
1.2 Scope 11
1.3 Documentation Forma t 11
2 WELCOME TO CPCL! 12
2.1 Designations – Unprintable ASCII 13
2.2 Designations – Parameters 14
2.3 Designations – Advanced Notes 14
2.4 Designations – Raw ASCII and Hex 15
2.5 Designations – Binary Data 15
3 INTRODUCTION TO CPCL 17
3.1 Sessions 18
3.2 Label Sessions 18
3.3 Parameters for Sessions and Commands 19
3.3.1 Numeric Parameters 19
3.3.1.1 Unit Numbers 19
3.3.1.2 Numbers 19
3.3.1.3 Number Interpretation Rules 20
3.3.2 String Parameters 20
3.3.2.1 Terminated String Parameters 21
3.3.2.2 Quoted String Parameters 21
3.3.2.3 Raw String Parameters 21
3.4 Utilities Sessions 22
3.5 Single Line Utilities Session 22
3.6 File Sessions 23
3.6.1 Define Format File Session 23
3.6.2 Use Format File Session 23
3.6.3 CISDF Format File Session 24
3.7 Line Print Mode 25
CPCL FOR LINK-OS PRINTERS
Page 3 of 329 1073699-001
4 CPCL COMMANDS OVERVIEW 27
4.1 Alphabetical Command Lists 29
4.2 Escape Commands List 33
5 HOW COMMANDS ARE DOCUMENTED 34
6 LABEL FORMATTING COMMANDS 37
6.1 Label Session Details 38
6.2 BARCODE 40
6.2.1 1D Barcodes 40
6.2.2 Aztec Code Barcode 44
6.2.3 Data Matrix Barcode 51
6.2.4 GS1 DataBar (RSS) and Composite Barcodes 58
6.2.5 MaxiCode Code Barcode 69
6.2.6 PDF417 73
6.2.7 QR Code Barcode 78
6.3 BARCODE-TEXT 85
6.4 BAT-INDICATOR 87
6.5 BOX 89
6.6 CENTER 92
6.7 COMPRESSED-GRAPHICS 94
6.8 CONCAT 96
6.9 COUNT 101
6.10 END 104
6.11 EXPANDED-GRAPHICS 104
6.12 FONT-GROUP 107
6.13 IMAGE 110
6.14 IN-CENTIMETERS, IN-DOTS, IN-INCHES, IN-MILLIMETERS 112
6.15 INVERSE-LINE 114
6.16 LEFT 117
6.17 LINE 118
6.18 MOVE 120
6.19 MULTILINE 124
6.20 PAGE-WIDTH 127
6.21 PATTERN 130
6.22 PCX 134
6.23 PCXMAG 136
6.24 PERSIST 138
CPCL FOR LINK-OS PRINTERS
Page 4 of 329 1073699-001
6.25
PRINT 139
6.26 RIGHT 140
6.27 ROTATE 142
6.28 SCALE-TEXT 144
6.29 SCALE-TO-FIT 146
6.30 SETBOLD 148
6.31 SETMAG 151
6.32 SETSP 154
6.33 TEMP-MOVE 156
6.34 TEXT 158
7 LINE PRINT COMMANDS 163
7.1 Line Print System Details 164
7.2 LMARGIN 166
7.3 LP-LF-EQUALS-CRLF 168
7.4 LP-ORIENT 170
7.5 RX, RY, RXY 173
7.6 SETLF 175
7.7 SETLP 176
7.8 SETLP-BUFFER 179
7.9 SETLP-TIMEOUT 180
7.10 X, Y, XY 181
7.11 <LF> – Line Feed 183
7.12 <CR> – Carriage Return 184
7.13 <ESC>g – Line Print Graphics 185
8 FONT COMMANDS 188
8.1 Introduction to CP CL Font Types 189
8.1.1 CPF (Comtec Pre-scaled) Fonts 189
8.1.2 CSF (Comtec Scaleable) Fonts 189
8.1.3 TTF (True Type) Fonts 189
8.2 Built in CPCL Fonts 190
8.3 Detailed CPF File Format Information 190
8.3.1 File Header 191
8.3.2 Character Pages 192
8.3.2.1 Header 192
8.3.2.2 Offset Table 193
8.3.2.3 Glyph Data 194
CPCL FOR LINK-OS PRINTERS
Page 5 of 329 1073699-001
8.3.2.4
8.3.2.5 Small Glyphs 194
8.3.2.6 Large Glyphs 194
8.3.2.7 Pen Adjusts 195
8.3.2.8 Non-Compressed Glyph Data 195
8.3.2.9 Compressed Glyph Data 196
8.3.3 Font Encodings – Single Byte 198
8.3.3.1 USA or Dynamic – COUNTRY USA 198
8.3.3.2 United Kingdom – COUNTRY UK 198
8.3.3.3 French – COUNTRY FR ANCE 200
8.3.3.4 Italian – COUNTRY ITALY 200
8.3.3.5 Swedish – COUNTRY SWEDEN 200
8.3.3.6 Spanish – COUNTRY SPANISH 201
8.3.3.7 Norwegian – COUNTRY NORWAY 201
8.3.3.8 LATIN 9 Encoding – COUNTRY LATIN9 201
Glyphs Types 194
8.3.3.9 Code Page 850 Encoding – COUNTRY CP850 202
8.3.3.10 Code Page 874 Encoding – COUNTRY CP874 202
8.3.4 Font Encodings – Multi-byte 202
8.3.4.1 CHINA, JAPAN and KOREA Encodings 203
8.3.4.2 BIG5 Encoding 204
8.3.4.3 JAPAN-S (Shift-JIS) Encoding 204
8.3.4.4 THAI Encoding 204
8.3.4.5 VIETNAM Encoding 204
8.3.4.6 Encoding Types for Common Fonts 205
8.4 CHAR-SET and COUNTRY 205
9 MEDIA MANAGEMENT COMMANDS 208
9.1 AUTOCAL 209
9.2 AUTO-PACE 210
9.3 BAR-SENSE 212
9.4 CONTRAST 213
9.5 FEED 214
9.6 FORM 215
9.7 FORM (Utilities Command) 215
9.8 GAP-SENSE 216
9.9 JOURNAL 217
9.10 LABEL 218
9.11 MULTI 219
CPCL FOR LINK-OS PRINTERS
Page 6 of 329 1073699-001
9.12
NO-PACE 220
9.13 ON-OUT-OF-PAPER 221
9.14 PACE 224
9.15 PAPER-JAM 225
9.16 POSTFEED 227
9.17 PREFEED 228
9.18 PRESENT-AT 229
9.19 REVERSE 230
9.20 REVERSE (Utilities Command) 231
9.21 SETFF 232
9.22 SET-TOF 233
9.23 SPEED 234
9.24 TONE 235
9.25 TURN 236
9.26 <FF> – Form Feed 237
10 STATUS ENQUIRY COMMANDS 240
10.1 NAME 241
10.2 VERSION 241
10.3 <ESC>h – Printer Status 242
10.4 <ESC>i – Extended Printer Status 243
10.5 <ESC>v – Get Version Information 244
11 UTILITY AND DIAGNOSTIC COMMANDS 245
11.1 Two Key Report Information 246
11.1.1 Two Key Items without equivalent SGDs 248
11.1.1.1 OS 249
11.1.1.2 Pres, Gap, and Bar Sections 249
11.1.1.3 Voltage 249
11.1.1.4 Resident Fonts 249
11.2 Parameter Insert Commands 250
11.2.1 Insert Current Date 250
11.2.2 Insert Current Time 251
11.2.3 Insert SGD Value 251
11.2.4 Insert Custom Result 252
11.2.5 Insert File 252
11.2.5.1 Difference between USE-FORMAT and File Insert 253
11.2.6 Using More Than One Insert per Line 254
CPCL FOR LINK-OS PRINTERS
Page 7 of 329 1073699-001
11.3
ABORT 255
11.4 BAUD 256
11.5 BEEP 257
11.6 CAPTURE 258
11.7 CHECKSUM 259
11.8 CHAR-COUNT 260
11.9 DELAYED-ACTIONS 261
11.10 DISPLAY 262
11.11 DUMP 264
11.12 DUMP-IMAGE 265
11.13 GET-DATE 267
11.14 GET-TIME 268
11.15 GETVAR 269
11.16 LT (Line Terminator) 272
11.17 MAX-LABEL-HEIGHT 274
11.18 ON-FEED 275
11.19 ON-LOW-BATTERY 276
11.20 RE-RUN 277
11.21 SET 278
11.22 SET-DATE 281
11.23 SET-TIME 282
11.24 SET-VERSION 283
11.25 SETVAR and DO 284
11.26 TIMEOUT 286
11.27 WAIT 287
11.28 VCHECKSUM 288
11.29 X, Y, XY (Label Sessions) 289
11.30 <BEL> – Sound Printer Bell 291
11.31 <BS> – Backspace 292
11.32 <ESC>} – Get or Set CCL Key 293
11.33 <ESC>I – Send Two-Key Report to Host 294
11.34 <ESC>JRU – Send User Label Count 294
11.35 <ESC>N – Acknowledge Reset 295
11.36 <ESC>p – Shut Down Printer 295
11.37 <ESC>V– Print Two-Key Report 296
12 MAGNETIC CARD READING COMMANDS 298
12.1 MCR 299
CPCL FOR LINK-OS PRINTERS
Page 8 of 329 1073699-001
12.2
MCR-CAN 303
12.3 MCR-QUERY 304
13 FILE COMMANDS 306
13.1 CPCL File System Introduction 307
13.1.1 The E Drive 307
13.1.2 The R Drive 307
13.1.3 The Z Drive 307
13.1.4 Filenames 307
13.1.5 File Functions Provided By CPCL 308
13.1.6 Special File Types 308
13.2 Define and Use Format Sessions 308
13.2.1 DEFINE-FORMAT and USE-FORMAT 308
13.2.2 Defining Fields in DEFINE-FORMAT Sessions for use with USE-FORMAT 309
13.2.3 USE-FORMAT Reentrance 311
13.3 CISDF, CISDFCRC16, and CISDFRCRC16 File Sessions 311
13.3.1 Calculating the CRC16 Checksum 314
13.3.2 Calculating the Simple Checksum 315
13.4 Pre-defined Special Purpose Files 316
13.4.1 CONFIG.SYS, AUTOEXEC.BAT, RUN.BAT 316
13.4.2 SEL.BAT, FTN. BAT, FF.BAT 316
13.4.3 FF3.BAT 317
13.5 DELETE 318
13.6 DIR 320
13.7 END (File Session) 321
13.8 FILE 322
13.9 PRINT (File Session) 324
13.10 TYPE 325
14 REMOVED AND UNSUPPORTED COMMANDS 328
CPCL FOR LINK-OS PRINTERS
Page 9 of 329 1073699-001
CPCL FOR LINK-OS PRINTERS
Page 10 of 329 1073699-001

1 Description

1.1 Purpose

This document is a non-final formatted version of a user manual intended to be the final version of documentation for the CPCL language as implemented in Link-OS enabled printers.

1.2 Scope

The document shall cover an introduction to the language, language concepts, and documentation for every command in CPCL. The documentation also touches on SGD, but does not provide an extensive set of documentation for that system, only to explain the SGD equivalents of various CPCL commands.
Documentation in all sections from section 2 to section 14 are intended directly for customer use, and contain no information that should not be exposed to customer s .

1.3 Documentation Form at

The text in this document is intended to be formatted into a form that can be used directly in a user manual or guide.
CPCL FOR LINK-OS PRINTERS
Page 11 of 329 1073699-001

2 Welcome to CPCL!

Welcome to the CPCL for Link-OS™ enabled printers manual. This manual is intended to help you understand how the C PCL formatting language works, and also provide a full reference of all the supported commands within the CPCL language.
This manual is divided into several sections. If you are completely new to working w ith CPCL, it is recommended that you proceed through the manual section by section, starting with the Introduction to Working With CPCL.
Introduction to Working With CPCL – CPCL Sessions
This section will provide you with details about the overall format and structure of labels and commands within CPCL.
CPCL Commands Referenc e
This section provides documentation for each CPCL command. Examples for many commands will be provided, and notes about how this command works with other commands is also provided. The CPCL command reference section is sub-divided so that you can easily find inf ormation about the areas you are looking for.
To start off the section, there is a master list of all commands, and the page their documentation appears on. Followin g that, each section contains an introduction discussion outlining the functions, followed by commands.
o CPCL Lab el Formatting Comman ds
This section contains all commands related to label layout and formatting – that is the graphical content of the label. This includes barcod es, text, and graphics.
o CPCL Line Print Commands
This section contains all commands related to line-print operations, in which the printer can be configured to receive raw ASCII text an d pr int it .
o CPCL Fo nts
This section contains all commands related to custom fonts in CPCL, including file and data formats, and usage.
o CPCL Media Management
This section contains information relate d to commands for feeding media, and also controlling how media is detected and sensed.
o CPCL Status and Enquiry Commands
This section contains information on how to obtain printer status via CPCL.
CPCL FOR LINK-OS PRINTERS
Page 12 of 329 1073699-001
Command
Byte transmitted
<NUL>
0
<SOH>
1
<STX>
2
<ETX>
3
<EOT>
4
<ENQ>
5
<ACK>
6
<BEL>
7
<BS>
8
<HT>
9
o The CPCL File System
This section contains information on using files within CPCL, including special file designations, and commands to create and delete files.
o Utility and Diagnostic Commands
This section contains information on commands related to diagnostic and utility functions. These include commands to dump printed data

2.1 Designations – Unprintable ASCII

While most of CPCL is in plain ASCII text, proper termination of lines is critical to proper operation. The line-termination characters, as well as some characters from the Comtec escape language are not printable characters. As such, this document will use the following designations to indicate binary data.
In this manual, text which denotes an example will be designated using the Courier New font as shown in this simple example below:
! 0 200 200 100 1<CR><LF> TEXT 4 0 0 This is a line of text.<CR><LF> PRINT<CR><LF> <ESC>h
The greater than and less than symbols are used to designate areas of data that are to be converted to binary – the <CR> is a visual representation of the non-printable “carriage return” character, while the <LF> is the visual representation of the non-printable “line-feed” character. If you were streaming b inary directly to the printer, you would not send the <CR>, but instead send a carriage return character (ASCII Character 13, hex 0x0D).
Typically in this document, each <CR> and <LF> will be followed by a new line within the document. This new line is not transmitted and is only for ease of reading of exam p les.
These designations are the standard ASCII names for these non-printable characters, however a table of the binar y values of the cha racters is also included here. In the case that the greater than or less than characters are needed in an example, they will be represented by <GT> and <LT> to avoid confusion.
CPCL FOR LINK-OS PRINTERS
Page 13 of 329 1073699-001
Command
Byte transmitted
<TAB>
9
<LF>
10
<VT>
11
<FF>
12
<CR>
13
<SO>
14
<SI>
15
<DLE>
16
<DC1>
17
<DC2>
18
<DC3>
19
<DC4>
20
<NAK>
21
<SYN>
22
<ETB>
23
<CAN>
24
<EM>
25
<SUB>
26
<ESC>
27
<FS>
28
<GS>
29
<RS>
30
<US>
31
<SP>
32
<LT>
60
<GT>
62
<DEL>
127

2.2 Designations – Parameters

For many functions in CPCL, there are required and optional parameters. These parameters are represented with the following syntax.
SAMPLECOMMAND [Required 1] [Required 2] [Opt. Parameter 1]
Required parameters will appear in non-italics, a nd w ill each bear a unique name. Optional parameters will appear in italics, and will be preceded by the abbreviation “Opt.”
Below each such designation, a list of the parame ters with their functions, options and meanings will be shown.

2.3 Designations – Advanced Notes

CPCL FOR LINK-OS PRINTERS
Page 14 of 329 1073699-001
This document is designed to be used by both people who are new to the CPCL language, and those who have worked with it extensively and are looking to understand a subtle detail of the system. For the more advanced user, after text which provides a basic explanation of the functionality of a particular area, an Advanced Notes section may appear. This section will pr ovide technical information on the command or function.
If you are new to the language, or only require a basic understanding, the Advanced Notes Sections can safely be skipped in order to keep to the core concepts of the topic being discussed.

2.4 Designations – Raw ASCII and Hex

When necessary, this manual will use a designation to indicate the transmission of ra w ASCII data. The formatting of data is very similar to what was mentioned above. The greater than and less
than symbols are used to designate areas of data that are to be converted to binary – the <15> means send the ASCII character 15. Using the above system, this would be the same as using <SI>.

2.5 Designations – Binary Data

When necessary, this manual will use a designation to indicate the transmission of raw binary da ta. To designate areas of data that are to be converted to binary, the manual will use a less than
symbol, then the text SEQ, followed by a series of hexadecimal characters, and finally a greater than symbol.
The net output of this is the binary equivalent to the hexadecimal data provided. See the example below:
As it appears in an example:
<SEQ 5468697320697320616E206578616D706C65206F662062696E61727920646174612E>
This represents:
This is an example of binary data.
This example is provided for ease of understanding, but typically this representation will only be used for data that is otherwise contains unreadable characters, notably binary image data.
CPCL FOR LINK-OS PRINTERS
Page 15 of 329 1073699-001
CPCL FOR LINK-OS PRINTERS
Page 16 of 329 1073699-001

3 Introduction to CPCL

CPCL, short for Comtec Printer Co ntrol Language, is the name of a printer control language that was used in printers originally made by Comtec Information Systems, which Zebra Technologies acquired in 2000.
The language consists of two parts, a label format ting language and an unformatted test printing system called line print mode.
Although the ZPL (Zebra Printer Language) is the preferred language for new development, support for CPCL is still included in select Link-OS enabled ZPL prin ters for compatibility with existing applications.
It is important to understand that CPCL is maintained only for backwards compatibility, and new features added to ZPL are generally not made available in CPCL.
Commands in the CPCL formatting language are almost entirely represented in human-readable ASCII. There are two modes of operation in the CPCL language, depending on the operation you intended to perform.
All operations in CPCL begin with the exclamation mark character “!”. What comes after this character determines which of the primary roles will be used to execute commands. These roles are called sessions. The “!” character signals to the printer that the CPCL interpreter is the target of this data stream, and is a request to begin a session. If this character does not start a line of transmission, the data will fall through to the next parser.
In CPCL, all commands should be transmitted in upper case. String values for commands may be transmitted in either case. By default, transmission of CPCL is performed in 8-bit ASCII characters.
Once you have entered a CPCL session using the “!” character, every line in the session must be terminated with the CR and LF characters.
Sessions are ended with a specific command which terminates them. See each session below for more details.
If you transmit a command that CPCL doesn’t know ho w to process, or a com mand in the wrong case, the entire line containing the command is ignored up to the next <CR> and <LF> character sequence.
If you transmit an invalid or unrecognized session command, the entire session will fall through to the line print system if it is enabled, or if it is not enabled, the next parser in the system. For more information on line print see section 3.7 on page 25.
Advanced Notes
See CPCL Line Print on page 164 for more information the handling of data which does not begin with an
exclamation mark as well as parsing order.
It is possible to change the character used to begin sessions from the exclamation point to other characters. This
character is called the CCL key, and documentation on changing it can be found on page 293. At power on, it is always set to the “!” by default. This document will assume you are using this default.
Some examples in the past have shown CPCL lines terminated with space characters. While this may function in
some cases, use of this syntax is not recommended for new labels as it is not compatible with all commands.
CPCL FOR LINK-OS PRINTERS
Page 17 of 329 1073699-001
It is possible to change the way lines are terminated in CPCL. See the LT command in on page 272 for more information. At power on, it is always set to <CR><LF> by default. This document will assume you are using this default.
One CPCL Command, SET, is not <CR><LF> terminated, but quote terminated. See this command on page 278 for more information.
If you are using a non-standard terminator (set by LT), lines starting with invalid commands are still consumed up to the next <CR><LF>.

3.1 Sessions

In CPCL, there are four types of sessions that can be started with the “!” character. Some commands may act differently depending on the kind of session you are currently using. Each of these types are explained in this section.
In addition, just after the Label Session documentation, there is a section which explains each type of parameter that can be used in CPCL.
Label Session
This session is used to create labels to perform printing.
Utilities Session
This session is used to execute a series of non-printing configuration commands.
One Line Utilities Session
This session is used to execute a single configuration command.
Files Sessions
There are several types of file sessions. These will not be documented here, but full documentation is provided in the CPCL File System section on page 307.

3.2 Label Sessions

A label that contains information to be printed begins with the ! character, followed by a series of ASCII numbers which represent information about the label that follows.
After the header, the label session can contain any number of utility or printing commands. To terminate the session, use the PRINT or END command. See page 139 for more information on this command.
When the PRINT or END command is received, the label will be printed. The format of the numbers which configure a label session are as follows.
! [Offset] [Horizontal Res.] [Vertical Res.] [Height] [Quantity]<CR><LF>
CPCL FOR LINK-OS PRINTERS
Page 18 of 329 1073699-001
Requested Unit
CPCL Command
Conversion Factor to Dots
Dots (Default)
IN-DOTS<CR><LF>
1
Centimeters
IN-CENTIMETERS<CR><LF>
80
Millimeters
IN-MILLIMETERS<CR><LF>
8
Inches
IN-INCHES<CR><LF>
203.2
Typically, a value of 0 is used for the offset, indicating the label is aligned to the right edge of the media. The resolution values are typically both 200. The he ight can be set to a ny value and is measured in the active unit, and any value for the quantity. For more detailed information about configuring label sessions see section 6.1 on page 38.
Sample Label Session
Below is a very simple label session which prints a small text message.
! 0 200 200 203 1<CR><LF> TEXT 4 0 40 40 Hello World!<CR><LF> PRINT<CR><LF>
See the TEXT command on page 158 for more information on that co mmand.

3.3 Parameters for Sessions and Commands

CPCL sessions and commands use numeric and string parameters in order to specify data. This section discusses each of the parameter types you will see used throughout the manual.

3.3.1 Numeric Parameters

In the example shown above, you see several references to numbers and unit numbers. It is important to understand how ea ch of these parameter types are used, as they are used continually throughout the CPCL language.
For all numeric parameters, null characters within the numbers will be ignored.
3.3.1.1 Unit Numbers
In the CPCL language, values related to size or positioning may be specified in units. By default, these values are measured in dots, but commands are provided to allow any unit value to be interpreted in dots, centimeters, millimeters, and inches.
These commands are as follows:
There is additional documentation for these commands in the label formatting commands starting on page 37. If one of these commands is the very first command after a label session command, it affects the label session command. The command otherwise takes effect immediately for any commands which use unit numbers that follow.
When reading in unit numbers, CPCL uses the number interpretation rules mentioned below.
3.3.1.2 Numbers
CPCL FOR LINK-OS PRINTERS
Page 19 of 329 1073699-001
Regular numeric parameters in CPCL are any parameter that expresses a quantity that is not in terms of any label formatting. These values are taken direct ly, and when you se e them documented in this manual, the unit will be provided.
When reading numbers, CPCL uses the number interpretation rules mentioned below.
3.3.1.3 Number Interpretation Rules
When a number is read by CPCL, it follows the same set of reading rules if the value is a raw number or a unit number.
Numbers in CPCL can be positive or negative and can have a fractional portion with up to four decimal places. If the number is negative, the minus character ‘-‘ must precede the first digit of the number. If the minus sign is not present, the number is assumed to be positive. The ‘+’ may also be specified, but is not necessary.
Many functions in CPCL are not sensitive to negative numbers, and as such will simply use the absolute value when a negative number is specified. Each command in this manual is documented regard ing its behavior with negative numbers.
Following the desig nation of sign, there can be any nu mber of leading zeroes. These are bypassed until the first non-zero digit is found.
Next, a number of digits determined by the particular command in use is collected. Ea ch command documented in this manual reports on the number of digits it expects.
CPCL numbers may have up to four digits after the decimal point. If you need to specify a number with a fractional portion, use the period character “.” to designate that there is a fractional portion. If the entire value of the parameter is fractional (that is there is no decimal component), a leading zero is optional;
0.56 and .56 are both valid forms. CPCL functions accept up to four decimal places of accuracy for fractional portions. This is true for all CP CL functions which accept numbers.
A number or unit number parameter is terminated by a space character. This signals to CPCL that the number has ended. If a number is the last parameter of a command or session line, a <CR><LF> can terminate the line. In this case, a space is not necessary and should not be added.
If the number of digits is exceeded (not including leading zeroes or symbols), the number is considered complete, and processing of the next parameter starts with the next character. If a character within a number is not a digit, this also completes the number, and processing of the next parameter begins with the next character. This is also the case if the number of decimal numbers exceeds four.
It is recommended that you only terminate your numbers with space characters in order to improve readability of your session data.

3.3.2 String Parameters

Strings are a parameter type in CPCL that is used to represent data. There are three main types of string parameters in CPCL: terminated string parameters, quotation string parameters, and raw string parameters.
CPCL FOR LINK-OS PRINTERS
Page 20 of 329 1073699-001
3.3.2.1 Terminated String Parameters
Terminated string parameters are a series of alpha numeric characters that are terminated by the CR and LF at the end of a line or by a space character, or either of the two. The terminator is determined by the specific command in which the parameter is used. Each command which uses terminated string parameters will specify what the terminator is.
Typically, terminated string parameters are limited to 8191 bytes in size. There are some exceptions to this, so each command which uses terminated string parameters will also call out the maximum size of the string parameter.
These terminated string parameters accept any character except the chosen terminator (Space or CR and LF by default), although null characters will be stripped out of the stream as if they did not exist.
If the number of characters provided exceeds the limit, the command which contained the parameter will fail, and the remainder of the command line, up to the next <CR><LF>, will be discarded.
3.3.2.2 Quoted String Parameters
Quoted string parameters are similar to raw string parameters except they are bound by a double quotation mark on each end ("). It is important to note that the proper character to use when transmitting a quoted string parameter is the ASCII character 34 (hex 0x22).
Typically, quoted string parameters are limited to 8191 bytes in size. There are some except ions to this, so each command which uses raw string parameters will also call out the maximum size of the string parameter.
If necessary, the double quotati on character can be included in a quoted s tring param eter. This can be accomplished by placing a backslash character before a double quotation character as shown below:
"This example has a double quote here:\""
The actual output of this string would be as follows: This example has a double quote here:"
Note that the \" sequence has been replaced by a double quotation mark. Within quoted string parameters, all other ASCII characters including CR and LF, with the exception of
null, are permitted and valid. Null characters are stripped out.
Although it is not technically necessary to terminate a series quoted string parameters with a space, it is highly recommended for readability. This is also true of <CR><LF> termination of commands that end with a quoted string parameter. The notable exception to this is the SETVAR and GETVAR commands, which must be <CR><LF> or space terminated. See those commands for more information.
3.3.2.3 Raw String Parameters
CPCL FOR LINK-OS PRINTERS
Page 21 of 329 1073699-001
Raw string parameters are typically used when the parameter consists entirely of binary data, which may include nulls or other control characters. Raw string parameters are typically used when the size of the parameter is specified directly as part of the command (such as with the COMPRESSED-GRAPHICS command), or are part of a structured file which contains its own size information (such as the PCX command).
Raw string parameters are typically not limited in size like other types of string parameters, but their output is limited to available memory. Each command which uses raw string parameters will explain how their limits are used.

3.4 Utilities Sessions

A utilities session contains commands that specify configuration information, but does not result in any printed output. This session is started by a ! character followed by either the upper case word UTILTIES or the upper case letter U followed by a CR and LF.
! UTILTIES<CR><LF> ! U<CR><LF>
As demonstrated here, there are a number of commands in CPCL which have short forms which are functionally identical to their long forms. When commands have a short-form, it will be documented at the start of each command.
Utilities sessions are terminated by the PRINT or END command. See page 139 for more informati on on these commands.
In the definition of each command, you will see if t he command operates label sessions, utilities sessions or both. With very few exceptions, utilities commands act the same whether they are in label or utilities sessions. If there are exceptions, they will be noted in the individual commands.
If you use label printing commands within a utilities session, they are ignored. Note that some utilities commands can move media, so keep this in mind when making utilities sessions.
Sample Utilities Session
This small sample utilities session configures the printer with a pair of configuration commands.
! UTILITIES<CR><LF> CONTRAST 0<CR><LF> BEEP 8<CR><LF> END<CR><LF>
See the CONTRAST command on page 213 and the BEEP command on pa ge 257 for more information.

3.5 Single Line Utilities Session

A single line utilities session is very similar to a utilities session except it is used to execute exactly one utilities command, and does not require the termination command END or PRINT. A single line utilities session is terminated by a <CR><LF>.
! U1 [CPCL Utilities Command with all parameters]<CR><LF>
CPCL FOR LINK-OS PRINTERS
Page 22 of 329 1073699-001
Field Name
Description
Type
Valid Range
Filename
The name of a filename to create on the
<CR><LF>
38 alpha-numeric and period for extension
Field Name
Description
Type
Valid Range
Filename
The name of a filename of the format to
<CR><LF>
38 alpha-numeric and period for extension
Sample Single Line Utilities Session
! U1 CONTRAST 0<CR><LF> ! U1 BEEP 8<CR><LF>
These two commands are each complete single line utilities sessions. These two commands have the same function as the full-form utilities section shown in the above section.

3.6 File Sessions

Although they will not be covered in detail here, there are three types of file definition sessions in CPCL. These sessions are used when you are defining a file or format which will be stored in the printer’s flash memory file system. These are covered in detail starting in section 13.2 on page 308.
These file sessions are initiated via the following commands.

3.6.1 Define For m at File Session

This session is used to define a file with the filename specified, and is typically used to define label or utilities format files in ASCII. It is not recommended to transfer binary files to the printer, instead use the CISDF session mentioned below.
! DEFINE-FORMAT [Filename]<CR><LF> ! DF [Filename]<CR><LF>
Define Format file sessions are termina ted by an END or PRINT command. If terminated with the PRINT command, a line containing the PRINT command is appended to the end of the file.
The filename in this session can include a drive lett er. For more extensive information about DEFINE-FORMAT and a discussion of file names see page 308.

3.6.2 Use Format File Session

This session is used to execute a previously defined format with filename specified. These formats are typically ones previously defined with the Define Format syntax mentioned above.
! USE-FORMAT <[Filename]><CR><LF> ! UF <[Filename]><CR><LF>
CPCL FOR LINK-OS PRINTERS
file system.
use on the file system.
Page 23 of 329 1073699-001
Terminated String
Terminated String
characters plus drive letter
characters plus drive letter
Field Name
Description
Type
Valid Range
CRC16
A special CRC-16 that represents the the remainder of the header.
<CR><LF>
0 to FFFF as up to four value is 0, CRC is ignored.
Filename
The name of a filename to create on the
<CR><LF>
38 alpha-numeric and period for extension
File Size
The size of the file in hex.
<CR><LF>
0 to FFFFFFFF as up to 8 space.
Checksum
The 16 least significant bits of the result
<CR><LF>
0 to FFFF as up to four
The filename in this session can include a drive lett er. For more extensive information about USE-FORMAT and a discussion of file names, see page 308.

3.6.3 CISDF Format File Session

This session is used to transfer Binary or ASCII files to the printer . A CISDF session is the basic session for transferring a binary file to the printer. A CISD F file is always
stored to flash memory.
! CISDF<CR><LF> <[Filename]><CR><LF> <[File Size]><CR><LF> <[Checksum]><CR><LF> <[File Data]>
A CISDFCRC16 is very similar to the CISDF session, but adds a more robust mechanism for detecting errors during transfer in the form of a CRC. A CISDFCRC16 file is stored always stored to flash memory.
When using a CISDFCRC16 file, the checksum is ignored but still must be specified.
! CISDFCRC16<CR><LF> <[CRC16]><CR><LF> <[Filename]><CR><LF> <[File Size]><CR><LF> <[Checksum]><CR><LF> <[File Data]>
A CISDFRCRC16 is very similar to the CISDFCRC16 session, except the file is only stored in RAM, and is removed when the printer is powered off or rebooted.
When using a CISD FRCRC16 file, the checksum is ignored.
! CISDFRCRC16<CR><LF> <[CRC16]><CR><LF> <[Filename]><CR><LF> <[File Size]><CR><LF> <[Checksum]><CR><LF> <[File Data]>
CPCL FOR LINK-OS PRINTERS
checksum of all data to follow, including
file system.
Page 24 of 329 1073699-001
Terminated String
Terminated String
Terminated String
hexadecimal digit s. If
characters plus drive letter
hex digits. Limited to free
of adding each byte of the file together.
Terminated String
hexadecimal digit s.
File Data
Binary file data containing the number of
File Size
Raw String
Any data of File Size length.
bytes specified by
.
The filenames for these sessions can include a drive letter, but it will be overridden if it does not match the type specified. For information on the CRC format, and more details on the file sessions, see page
311.

3.7 Line Print Mode

Line print mode is a component of the CPCL formatting language which allo ws non-formatted text to be transmitted to the printer directly for printing.
This mode may or may not be enabled by default depending on your printer model, but the command to enable it is the same for all Link-OS printers which support CPCL.
Note that when CPCL line print mode is enabled, the printer can no longer process ZPL commands or commands from any other control language except CPCL.
To enable CPCL line print mode, use the following command:
! U1 SETVAR "device.languages" "line_print"<CR><LF>
And to disable it and enable the ZPL control language, use the following command:
! U1 SETVAR "device.languages" "hybrid_xml_zpl"<CR><LF>
Once enabled, printing with line print is very simple. Sending text terminated with CR and LF characters is all that is required for basic operation. Characters which are not terminate d with CR and LF will p rint after a short timeout, or when the printer’s buffer fills.The FF character can also be used to advance the form.
For a more detailed explanation of how line print works, see section 7.1 on page 164.
CPCL FOR LINK-OS PRINTERS
Page 25 of 329 1073699-001
CPCL FOR LINK-OS PRINTERS
Page 26 of 329 1073699-001

4 CPCL Commands Overview

Once you enter a CPCL session as documented on page 38, you can then use CPCL commands to accomplish printing or configuration tasks.
This section provides documentation for all CPCL commands supported in the Link-OS version of CPC L, and is divided into a number of section areas based on functions.
The layout of this section of the manual is as follows:
Alphabetical Command List
o CPCL Command List o Comtec Escape Command List
Understanding How Commands are Documented
CPCL Label Formatting Comma nds
o Introduction to Label Formatting Comma nds o CPCL Label Formatting Commands
CPCL Line Printing Commands
o Introduction to Line Printing in CPCL o CPCL Line Printing Commands
CPCL Font Command s
o Introduction to Fonts in CPCL o CPCL Code Page and Encoding Commands o CPCL Font Formats
Media Management Commands
o Overview and Common Cases in Media Management
Status Enquiry Commands
Utility and Diagnostic Commands
o Two Key Diagnostic Re p ort
Magnetic Card Reader Commands
File System Commands
o Introduction to the CPCL file system in Link-OS o Define and Use File Sessions o CISDF and CIDSFCRC File Sessions
CPCL FOR LINK-OS PRINTERS
Page 27 of 329 1073699-001
CPCL FOR LINK-OS PRINTERS
Page 28 of 329 1073699-001
CPCL Command
Type
Label?
Utilities?
Description
Page
ABORT
Utility & Diagnostic
Yes
No
Aborts current label format
255
AUTOCAL
Media Management
No
Yes
Calibrates sensor thresholds.
209
AUTO-PACE
Media Management
Yes
Yes
Delays future prints until previous is taken.
210
B
Label Formatting
Yes
Yes (Line Print)
Alias for BARCODE
38
BARCODE
Label Formatting
Yes
Yes (Line Print)
Prints a barcode in label mode.
38
BARCODE-TEXT
Label Formatting
Yes
Yes
Turns on or off text line below barcodes.
85
BAR-SENSE
Media Management
Yes
Yes
Enables the media mark or bar sensor
212
BAT-INDICATOR
Label Formatting
Yes
No
Prints an indicator showing battery charge.
87
BAUD
Utility & Diagnostic
No
Yes
Changes serial port baud rate.
256
BEEP
Utility & Diagnostic
Yes
Yes
Makes the printers beeper sound.
257
BI
Status Enquiry
Yes
No
Alias for BAT-INDICATOR
87
BOX
Label Formatting
Yes
No
Draws a box.
89
BT
Label Formatting
Yes
Yes
Alias for BARCODE-TEXT
85
CAPTURE
Utility & Diagnostic
Yes
Yes
Captures incoming print data to file.
258
CC
Utility & Diagnostic
No
Yes
Alias for CHAR-COUNT
260
CENTER
Label Formatting
Yes
Yes (Line Print)
Specifies alignment for text fields.
92
CG
Label Formatting
Yes
Yes (Line Print)
Alias for COMPRESSED-GRAPHICS
94
CHAR-COUNT
Utility & Diagnostic
No
Yes
Returns number of characters received so far.
260
CHAR-SET
Font Commands
Yes
No
Alias for COUNTRY.
205
CHECKSUM
Utility & Diagnostic
No
Yes
Gets application checksum.
259
COMPRESSED-GRAPHICS
Label Formatting
Yes
Yes (Line Print)
Places binary graphics on a label.
94
CONCAT
Label Formatting
Yes
No
Use text of different fonts or sizes on the same line.
96
CONTRAST
Media Management
Yes
Yes
Changes print darkness coarsely.
213
COUNT
Label Formatting
Yes
No
Creates text fields which increment or decrement.
101
COUNTRY
Font Commands
Yes
Yes
Changes code page.
205
DEL
File Commands
No
Yes
Alias for DELETE.
318
DELAYED-ACTIONS
Utility & Diagnostic
Yes
Yes
Perform an action in some fixed amount of time.
261
DELETE
File Commands
No
Yes
Delete a file from disk.
318
DIR
File Commands
No
Yes
Show file directory.
320
DISPLAY
Utility & Diagnostic
No
Yes
Used to show text on printer’s display
262
DO
Utility & Diagnostic
Yes
Yes
Alias for SETVAR.
284
do
Utility & Diagnostic
Yes
Yes
Lower case alias for SETVAR.
284
DUMP
Utility & Diagnostic
Yes
Yes
Enters dump mode.
264
DUMP-IMAGE
Utility & Diagnostic
Yes
No
Dumps label data
265
EG
Label Formatting
Yes
Yes (Line Print)
Alias for EXPANDED-GRAPHICS
104
END
Label Formatting
Yes
No
Alias for PRINT.
104
END (File Session Command)
File Commands
Yes
No
Ends the definition of a stored format.
321

4.1 Alphabetical Command Lists

This section provides an alphabetical list of all CPCL commands, their basic function, their classification, and on what page in this document full documentation can be found.
CPCL FOR LINK-OS PRINTERS
Page 29 of 329 1073699-001
CPCL Command
Type
Label?
Utilities?
Description
Page
EXPANDED-GRAPHICS
Label Formatting
Yes
Yes (Line Print)
Prints ASCII graphics on a label.
104
FEED
Media Management
No
Yes
Moves paper forward.
214
FG
Label Formatting
Yes
No
Alias of FONT-GROUP
107
FILE
File Commands
No
Yes
Renames or gets checksums of files.
322
FONT-GROUP
Label Formatting
Yes
Yes
Defines a font group.
107
FORM
Media Management
Yes
No
Advanced paper to the next mark at end of label.
215
FORM (Utilities Command)
Media Management
No
Yes
Advances paper to the next mark now.
215
GAP-SENSE
Media Management
Yes
Yes
Enables the gap or notch sensor.
216
GET-DATE
Utility & Diagnostic
Yes
Yes
Returns current date.
267
GET-TIME
Utility & Diagnostic
Yes
Yes
Returns current time.
268
GETVAR
Utility & Diagnostic
Yes
Yes
Returns SGD configuration setting value
269
getvar
Utility & Diagnostic
Yes
Yes
Lower case alias of GETVAR.
269
IL
Label Formatting
Yes
No
Alias of INVERSE-LINE.
114
IMAGE
Label Formatting
Yes
Yes
Sets drawing mode.
107
IN-CENTIMETERS
Label Formatting
Yes
Yes (Line Print)
Specifies that label is represented in centimeters.
112
IN-DOTS
Label Formatting
Yes
Yes (Line Print)
Specifies that label is represented in dots.
112
IN-INCHES
Label Formatting
Yes
Yes (Line Print)
Specifies that label is represented in inches.
112
IN-MILLIMETERS
Label Formatting
Yes
Yes (Line Print)
Specifies that label is represented in millimeters
112
INVERSE-LINE
Label Formatting
Yes
No
Draws an inverted line.
114
JOURNAL
Media Management
Yes
Yes
Specifies that a label does not end when a mark is found.
217
L
Label Formatting
Yes
No
Alias of LINE.
118
LABEL
Media Management
Yes
Yes
Specifies that a label ends when a mark is found.
218
LEFT
Label Formatting
Yes
Yes (Line Print)
Specifies alignment for text fields.
117
LINE
Label Formatting
Yes
No
Draws a line.
105
LMARGIN
Line Print
No
Yes (Line Print)
Sets left margin for line print text.
164
LP-LF-EQUALS-CRLF
Line Print
No
Yes (Line Print)
Sets LF to mean <CR><LF> in line print mode.
168
LP-ORIENT
Line Print
No
Yes (Line Print)
Sets the orientation of line print text.
170
LT
Utility & Diagnostic
Yes
Yes
Specifies the end of line terminator for label and utilities sessions
272
MAX-LABEL-HEIGHT
Utility & Diagnostic
No
Yes
Returns maximum supported label height
274
MCR
Card Reader
No
Yes
Configures the magnetic card reader
299
MCR-CAN
Card Reader
No
Yes
Cancels any pending magnetic card reader requests
303
MCR-QUERY
Card Reader
No
Yes
Retrieves card reader data when in query mode
304
ML
Label Formatting
Yes
No
Alias for MULTILINE
124
MOVE
Label Formatting
Yes
Yes
Moves label origin.
120
MULTI
Media Management
Yes
Yes
Used to set horizontal label quantity.
219
MULTILINE
Label Formatting
Yes
No
Prints multiple lines of text with same style.
124
NAME
Status Enquiry
No
Yes
Returns current firmware version.
241
NO-PACE
Media Management
Yes
Yes
Disables delaying of printing between labels
220
OLB
Utility & Diagnostic
Yes
Yes
Alias for ON-LOW-BATTERY.
276
ON-FEED
Utility & Diagnostic
Yes
Yes
Perform an action when the feed key is pressed.
275
ON-INDEX-MARK-ERROR
Media Management
Yes
Yes
Alias for PAPER-JAM.
225
ON-LOW-BATTERY
Utility & Diagnostic
Yes
Yes
Perform an action when battery is low.
276
ON-OUT-OF-PAPER
Media Management
Yes
Yes
Perform an action when out of paper error occurs.
221
PA
Media Management
Yes
Yes
Alias for PRESENT-AT.
229
CPCL FOR LINK-OS PRINTERS
Page 30 of 329 1073699-001
Loading...
+ 299 hidden pages