Language | Swift 2.2 |
iOS Version | iOS 8.0 and above |
framework | PrinterCommandSwift.framework |
CPCL iOS SDK Reference Guide1 Label Formatting Commands1.1 Label Sessions1.2 Barcode1.2.0 Barcode 1D1.2.1 Barocde Aztec1.2.2 Data Matrix1.2.3 DataBar(RSS) and CompositeBarcodes1.2.4 Maxicode1.2.5 PDF4171.2.6 QR Code1.3 Barcode Text1.4 Bat-Indicator1.5 Box1.6 CompressedGraphics1.7 Concat1.8 Count1.9 End/Print1.10 ExpandedGraphics1.11 FontGroup1.12 Image1.13 Centimeters, Dots, Inches, Millimeters1.14 InverseLine1.15 Left, Center, Right1.16 Line1.17 Move1.18 Multi-Line1.19 Page Width1.20 Pattern1.21 PCX1.22 PCXMAG1.23 Persist1.24 Rotate1.25 Scale Text1.26 Scale To Fit1.27 Set Bold1.28 Set Mag1.29 Set Spacing1.30 Temp Move1.31 Text2 Line Print Commands2.1 Left Margin2.2 LF equals CRLF (Line Print)2.3 Orient (Line Print)2.4 Line Print Position Adjust2.5 Set LF2.6 Set LP2.7 Set LP Buffer2.8 Set LP Timeout2.9 Set Position2.10 Line Feed2.11 Carriage Return2.12 Line Print Graphics3 Font Commands3.1 File Header3.2 Char Set And Country4 Media Management Commands4.1 Auto Cal4.2 Auto Pace4.3 Bar Sense4.4 Contrast4.5 Feed4.6 Form4.7 Gap Sense4.8 Journal4.9 Label4.10 Multi4.11 No Pace4.12 Out Of Paper4.13 Pace4.14 Paper Jam4.16 PostFeed/PreFeed4.17 Present AT4.18 Reverse4.19 Set Feed Length and Skip (Set FF)4.20 Set TOF4.21 Speed4.22 Tone4.23 Turn4.24 Form Feed5 Status Enquiry Commands5.1 Name5.2 Version5.3 Printer Status5.4 Extended Printer Status5.5 Get Version Information6 Utility and Diagnostic Commands6.1 Abort6.2 Baud6.3 Beep6.4 Capture6.5 Check Sum/Check Sum Vertical6.6 Char Count6.7 Delay Actions6.8 Display6.9 Dump6.10 Dump Image6.11 Get Date6.12 Get Time6.13 Get Var6.14 Line Terminator6.15 Max Label Height6.16 On Feed6.17 On Low Battery6.18 Re-Run6.19 Set Date6.29 Set Time6.30 Set Version6.31 Set Var and DO6.32 Time Out6.33 Wait6.34 Label Session Position6.35 Sound Printer Bell6.36 Backspace6.37 Get or Set CCL Key6.38 Send Two-Key Report to Host6.39 Send User Label Count6.40 Acknowledge Reset6.41 Shut Down Printer6.42 Print Two-Key Report7 Magnetic Card Reading Commands7.1 MCR7.2 MCR-CAN7.3 MCR-QUERY8 File Commands8.1 Define and Use Format Sessions8.2 Delete8.3 Dir8.4 End8.5 File8.6 Type
A label that contains information to be printed begins with the ! character, followed by a series of ASCIInumbers which represent information about the label that follows.
In order for this session to be detected, the first character of the Offset parameter must be a digit.
1public func cpclLabel(offset offset: Int, hRes: Int, vRes: Int, height: Int, quantity: Int)
Field Name | Description | Type | Valid Range |
---|---|---|---|
Offset | The number of units to offset all fields from the left side of the label horizontally. | Units Number | 0 to 65535 |
Horizontal Res. | The horizontal resolution of this label, expressed in dots per inch. | Number (in dpi) | 100 or 200 |
Vertical Res. | The vertical resolution of this label, expressed in dots per inch. | Number (in dpi) | 100 or 200 |
Height | The height of the label in units. | Unit Number | 0 to 65535 |
Quantity | The number of copies of the label to print. | Number (in quantity) | 0 to 1024 |
1cpclLabel(offset: 0, hRes: 200, vRes: 200, height: 210, quantity: 1)
2cpclCenter()
3cpclText(rotate: 0, font: 4, fontSize: 0, x: 10, y: 0, text: "This is a ! command.")
4cpclPrint()
The barcode command has several syntaxes based on the type of barcode being printed. The mostcommon syntax is the 1D barcode format.
1public func cpclBarcode(type type: String, width: Int, ratio: Int, height: Int, x: Int, y: Int, barcode: String)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Type | Space Terminated String | The type of barcode to print. | See table below. |
Width | 5 Digit Unit Number | The width of a narrow bar. | 0 to 65535 units |
Ratio | 5 Digit Number | The ratio of wide to narrow bars. | 0 to 4, 20 to 30. |
Height | 5 Digit Unit Number | The height of the barcode. | 0 to 65535 units |
X | 5 Digit Unit Number | The X position where the barcode begins | 0 to 65535 units |
Y | 5 Digit Unit Number | The Y position where the barcode begins | 0 to 65535 units |
Data | The data to be encoded into a barcode. | Up to 8191 bytes of Alpha Numeric Data. |
1cpclLabel(offset: 0, hRes: 200, vRes: 200, height: 210, quantity: 1)
2cpclBarcode(type: CPCLBarcodeType.Code128.rawValue, width: 1, ratio: 1, height: 50, x: 150, y: 10, barcode: "horizontal")
3cpclText(rotate: 0, font: 4, fontSize: 0, x: 180, y: 60, text: "HORIZ.")
4cpclBarcodeVertical(type: CPCLBarcodeType.Code128.rawValue, width: 1, ratio: 1, height: 50, x: 10, y: 200, barcode: "vertical")
5cpclText(rotate: 90, font: 4, fontSize: 0, x: 60, y: 180, text: "vertical")
6cpclPrint()
- The
BARCODE AZTEC
command is used to print Aztec Code barcodes in the CPCL language.VBARCODE AZTEC
is identical to BARCODE, except it is oriented vertically.- Note that this command has optional parameters XD, EC, F, ME, M and ID. In order to use these parameters, the optional parameter must be followed by a space, then a number which complies with the table below.
1public func cpclBarcodeAztec(xPos xPos: Int, yPos: Int, width: Int, erc: Int, flags: Int, menu: Int, multi: Int, idField: String)
Parameter | Type | Description | Valid Range |
---|---|---|---|
X | 5 Digit Unit Number | The X position where the barcode begins | 0 to 65535 units |
Y | 5 Digit Unit Number | The Y position where the barcode begins | 0 to 65535 units |
Width | 5 Digit Number | The dot-width of a single element in the code | 1 to 36 |
ERL | 5 Digit Number | The error recovery level or size | See below |
Flags | 5 Digit Number | Is the barcode using flag escapes? | 0 or 1 |
Menu | 5 Digit Number | Is the barcode a menu? | 0 or 1 |
Multi | 5 Digit Number | Is the barcode a structured append part? | 0 or 1 |
ID | The structured append ID field | Up to 25 ASCII Characters | |
Data | The data to be encoded in the barcode | See below |
- The
BARCODE DATAMATRIX
command is used to print Data Matrix barcodes in the CPCL language.- The command has a number of optional parameters, any number of which may be specified. If a parameter is specified more than once, the last value specified is used.
1public func cpclDataMatrix(xPos xPos: Int, yPos: Int, scale: Int, ecc: Int, columns: Int, rows: Int, format: Int, escapeChar: Int)
2public func cpclAddBarcodeDataMatrixData(barcodeDataMatrix: String)
3public func cpclEndDataMatrix()
Parameter | Type | Description | Valid Range |
---|---|---|---|
X | 5 Digit Unit Number | The X position where the barcode begins | 0 to 65535 units |
Y | 5 Digit Unit Number | The Y position where the barcode begins | 0 to 65535 units |
Scale | 5 Digit Number | The scale of the barcode. | 0 to 65535 |
ECC | 5 Digit Number | Specifies the level of error correction. | See Below. |
Columns | 5 Digit Number | Specifies the number of columns to use. | See Below. |
Rows | 5 Digit Number | Specifies the number of rows to use. | See Below. |
Format | 5 Digit Number | Specifies the data format when ECC is not 200. | 1 to 6 |
EscapeChar | Space Terminated String | Specifies the escape character to use. | See Below. |
Data | Raw String | Data for barcode | See Below. |
- This command is used to print GS1 Databar (also known reduced space symbology) barcodes in CPCL, as well as Composite barcodes. There are 12 supported sub-types of GS1 Databar\Composite barcodes.
- All barcode types supported by this command can consist of both a 1D and 2D component. If the barcode contains a 2D component, the output is referred to as a composite barcode. The 2D portion is optional, but the 1D portion is required.
- If the parameters of the barcode are incorrect, in place of the barcode, a text message indicating the problem encountered while trying to form the barcode will be printed.
1public func cpclBarcodeRSS(xPos xPos: Int, yPos: Int, scale: Int, lHeight: Int, sHeight: Int, segs: Int, type: Int, barcodeRSS: String)
Parameter | Type | Description | Valid Range |
---|---|---|---|
X | 5 Digit Unit Number | The X position where the barcode begins | 0 to 65535 |
Y | 5 Digit Unit Number | The Y position where the barcode begins | 0 to 65535 |
Scale | 5 Digit Unit Number | The X and Y scaling factor of the barcode. | 0 to 65535 |
LHeight | 5 Digit Unit Number | Height of the linear part of the barcode | 0 to 65535 |
SHeight | 5 Digit Unit Number | Height of the separator between barcode parts | 0 to 65535 |
Segs | 5 Digit Unit Number | The maximum number of segments per row | 0 to 65535 |
Type | 5 Digit Number | The type of RSS barcode to print. | 1 to 12 |
Data | 1D and 2D Data to Print | 8191 alphanumeric characters |
- The
BARCODE MAXICODE
command is used to print MaxiCode barcodes in the CPCL language. Only type-2 MaxiCode barcodes (which contain formatted data with a structured carrier message a d numeric postal code) can be used in CPCL.VBARCODE MAXICODE
is identical toBARCODE MAXI
. MaxiCode barcodes do not print in vertical orentation.- The barcode consists of fields that are represented with a field name followed by data. This field and data line can be repeated as many times as necessary to complete the barcode.
- MaxiCode barcodes are always of a fixed size, there are no options to adjust its size.
public func cpclBarcodeMaxicode(xPos xPos: Int, yPos: Int, field: Int, barcodeMaxicode: String)
Parameter | Type | Description | Valid Range |
---|---|---|---|
X | 5 Digit Unit Number | The X position where the barcode begins | 0 to 65535 units |
Y | 5 Digit Unit Number | The Y position where the barcode begins | 0 to 65535 units |
Field | Space Terminated String | The ratio of wide to narrow bars. | 1 or 2 |
Data | Unit-width of the barcode in dots | 0 to 65535 dots |
- The
BARCODE PDF-417
command is used to print PDF417 barcodes in the CPCL language.- The command has a number of optional parameters, any number of which may be specified. If a parameter is specified more than once, the last value specified is used.
- If a PDF-417 barcode’s parameter’s cause an error that would cause it not to print, a detailed error message will be displayed instead.
- There is no option to use structured append PDF-417 barcodes in CPCL.
1public func cpclBarcodePDF417(xPos xPos: Int, yPos: Int, XDot: Int, YDot: Int, columes: Int, rows: Int, ecc: Int, binaryModel: Int)
2public func cpclBarcodePDF417Vertical(xPos xPos: Int, yPos: Int, XDot: Int, YDot: Int, columes: Int, rows: Int, ecc: Int, binaryModel: Int)
3public func cpclBarcodePDF417Data(pdf417Data: String)
4public func cpclBarcodePDF417End()
Parameter | Type | Description | Valid Range |
---|---|---|---|
X | 5 Digit Unit Number | The X position where the barcode begins | 0 to 65535 units |
Y | 5 Digit Unit Number | The Y position where the barcode begins | 0 to 65535 units |
XDot | 5 Digit Number | The X size of a single element in dots | 0 to 65535 |
YDot | 5 Digit Number | The Y size of a single element in dots | 0 to 65535 |
Columns | 5 Digit Number | Specifies the number of columns to use. | 1 to 30 |
Rows | 5 Digit Number | Specifies the number of rows to use. | 0 to 90 |
ECC | 5 Digit Number | Specifies the error recovery level. | 1 to 8 |
BinaryMode | Single Digit | Force binary compaction mode | 0 or 1 |
Data | Raw String | The data to be encoded in the barcode. | See below. |
1cpclLabel(offset: 0, hRes: 200, vRes: 200, height: 210, quantity: 1)
2cpclCenter()
3cpclBarcodePDF417(xPos: 10, yPos: 20, XDot: 3, YDot: 6, columes: 3, rows: 3, ecc: 2, binaryModel: 1)
4cpclBarcodePDF417Data("pdf-417 data")
5cpclBarcodePDF417End()
6cpclText(rotate: 0, font: 1, fontSize: 0, x: 10, y: 120, text: "pdf data")
7cpclText(rotate: 0, font: 1, fontSize: 0, x: 10, y: 160, text: "abcde123456")
8cpclPrint()
9cpclLabel(offset: 0, hRes: 200, vRes: 200, height: 400, quantity: 1)
10cpclBarcodePDF417Vertical(xPos: 30, yPos: 400, XDot: 3, YDot: 6, columes: 3, rows: 3, ecc: 3, binaryModel: 1)
11cpclBarcodePDF417Data("pdf data vertical")
12cpclBarcodePDF417End()
13cpclText(rotate: 90, font: 1, fontSize: 0, x: 120, y: 400, text: "pdf data")
14cpclText(rotate: 90, font: 1, fontSize: 0, x: 170, y: 400, text: "abcde123456")
15cpclPrint()
- The BARCODE QR command is used to print QR Code barcodes in the CPCL language.
- VBARCODE QR is identical to BARCODE, except it is oriented vertically.
- Note that this command has optional parameters M, U. In order to use these parameters, the M or U character must be followed by a space, then a number which complies with the table below.
public func cpclBarcodeQRcode(xPos xPos: Int, yPos: Int, model: Int, unitWidth: Int) public func cpclBarcodeQRcodeVertical(xPos xPos: Int, yPos: Int, model: Int, unitWidth: Int, config: Int, barcodeQRcode: String) public func cpclBarcodeQRcodeData(barcodeQRcode: String, config: String) public func cpclBarcodeQRcodeEnd()
Parameter | Type | Description | Valid Range |
---|---|---|---|
X | 5 Digit Unit Number | The X position where the barcode begins | 0 to 65535 units |
Y | 5 Digit Unit Number | The Y position where the barcode begins | 0 to 65535 units |
Model | 5 Digit Number | The ratio of wide to narrow bars. | 1 or 2 |
Width | 5 Digit Number | Unit-width of the barcode in dots | 0 to 65535 dots |
Config | Raw String | Configuration options for barcode | See Below. |
Data | Raw String | Data for barcode | See Below. |
1cpclLabel(offset: 0, hRes: 200, vRes: 200, height: 500, quantity: 1)
2cpclBarcodeQRcode(xPos: 50, yPos: 50, model: 2, unitWidth: 5)
3cpclBarcodeQRcodeData("AQR code ABC123,N9876", config: "MM")
4cpclBarcodeQRcodeEnd()
5cpclPrint()
6cpclLabel(offset: 0, hRes: 200, vRes: 200, height: 210, quantity: 1)
7cpclBarcodeQRcode(xPos: 50, yPos: 50, model: 2, unitWidth: 10)
8cpclBarcodeQRcodeData("AQR code ABC123,N9876", config: "MM")
9cpclBarcodeQRcodeEnd()
10cpclPrint()
BARCODE-TEXT
is used to specify if a human-readable text representation of barcode data should be printed below 1D barcodes. This text is applied for both line-print and label-based barcodes.
1// print annotation text line
2public func cpclBarcodeText(font font: Int, fontSize: Int, offset: Int)
3public func cpclBarcodeText(trueTypeFont trueTypeFont: Int, xScale: Int, yScale: Int, offset: Int)
4// close annotation text line
5public func cpclBarcodeTextOff()
Parameter | Type | Description | Range |
---|---|---|---|
FontNameOrNumber | Space-Terminated String | A font name or number to create the representation | See Below. |
FontSize | 3 Digit Number | The size of the font. | 0 to 999 |
Offset | 3 Digit Unit Number | How far in units the text is from the barcode | 0 to 999 |
Parameter | Type | Description | Range |
---|---|---|---|
TrueTypeFontName | Space-Terminated String | The filename of the TTF font with extension | See Below. |
XScale | 3 Digit Number | The X size of the font, in dots. | 0 to 999 |
YScale | 3 Digit Number | The Y size of the font, in dots | 0 to 999 |
Offset | 3 Digit Unit Number | How far in units the text is from the barcode | 0 to 999 |
1cpclLabel(offset: 0, hRes: 200, vRes: 200, height: 400, quantity: 1)
2cpclCenter()
3cpclBarcodeText(font: 4, fontSize: 0, offset: 10)
4cpclBarcode(type: CPCLBarcodeType.Code128.rawValue, width: 1, ratio: 1, height: 50, x: 0, y: 20, barcode: "barcode data")
5cpclBarcodeVertical(type: "128", width: 1, ratio: 1, height: 50, x: 0, y: 390, barcode: "barcode data")
6cpclBarcodeTextOff()
7cpclPrint()
BAT-INDICATOR
is used to print a graphical representation of the current charge state of the battery on a label.TheBAT-INDICATOR
command takes a series of optional parameters to specify its size and configuration.
1public func cpclBatIndicator(xPos xPos: String, yPos: String)
Parameter | Type | Description | Valid Range |
---|---|---|---|
X | 5 Digit Unit Number | The X origin of the graphic. | 0 to 65535 |
Y | 5 Digit Unit Number | The Y origin of the graphic. | 0 to 65535 |
The
BOX
command is used to draw a box.By default,BOX
draws a box in solid black, but the pattern used to fill the box can be changed with thePATTERN
command.TheBOX
command can be used with the justify commandsCENTER
,LEFT
andRIGHT
to align the box.
1public func cpclBox(xPos xPos: Int, yPos: Int, xEnd: Int, yEnd: Int, thickness: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
X | 5 Digit Unit Number | The X origin of the box. | 0 to 65535 |
Y | 5 Digit Unit Number | The Y origin of the box. | 0 to 65535 |
EndX | 5 Digit Unit Number | The X coordinate where the box ends. | 0 to 65535 |
EndY | 5 Digit Unit Number | The Y coordinate where the box ends. | 0 to 65535 |
Thickness | 5 Digit Unit Number | The thickness of the lines in the box. | 0 to 65535 |
1cpclLabel(offset: 0, hRes: 200, vRes: 200, height: 210, quantity: 1)
2cpclBox(xPos: 0, yPos: 0, xEnd: 200, yEnd: 200, thickness: 1)
3cpclPrint()
4cpclLabel(offset: 0, hRes: 200, vRes: 200, height: 210, quantity: 1)
5cpclBox(xPos: 0, yPos: 0, xEnd: 200, yEnd: 200, thickness: 2)
6cpclPrint()
7cpclLabel(offset: 0, hRes: 200, vRes: 200, height: 210, quantity: 1)
8cpclBox(xPos: 0, yPos: 0, xEnd: 200, yEnd: 200, thickness: 3)
9cpclPrint()
The
COMPRESSED-GRAPHICS
command is used to print raw binary bitmap data to the label.COMPRESSED-GRAPHICS
is the same except it is oriented vertically. The data itself is not compressed per say, it is just more efficiently represented than in theEXPANDED- GRAPHICS
command. The binary data is not compressed in this command.
1public func cpclCompressedGraphics(imageWidth imageWidth: Int, imageHeight: Int, x: Int, y: Int, bitmapData: NSData)
2public func cpclCompressedGraphicsVertical(byteWidth byteWidth: Int, height: Int, x: Int, y: Int, bitmapData: NSData)
Parameter | Type | Description | Valid Range |
---|---|---|---|
ByteWidth | 3 Digit Number | The byte width of the image being transmitted. | 0 to 999 |
Height | 5 Digit Unit Number | The height of the data to follow in units. | 0 to 65535 |
X | 5 Digit Unit Number | The X origin of the graphic. | 0 to 65535 |
Y | 5 Digit Unit Number | The Y origin of the graphic. | 0 to 65535 |
Data | Raw String | The data that makes up the bitmap to be printed. | See below. |
The CONCAT command is used to concatenate multiple fonts and sizes of text on to a single line, and to align their top-lines in a specific way. The command starts with a CONCAT command, followed by one or more sub-commands. Each sub-command adds more text onto the concatenation from left to right.
1// Concat Begin (Master Syntax)
2public func cpclConcatStart(xPos xPos: Int, yPos: Int)
3public func cpclConcatVerticalStart(xPos xPos: Int, yPos: Int)
4// FontNameOrNumber
5public func cpclConcatText(font font: Int, fontSize: Int, offset: Int, text: String)
6// Sub-Command – Scale-Text
7public func cpclConcatScaleText(scaledFont scaledFont: Int, xScale: Int, yScale: Int, offset: Int, text: String)
8public func cpclConcatScaleTextVertical(scaledFont scaledFont: Int, xScale: Int, yScale: Int, offset: Int, text: String)
9// Sub-command – Font-Group
10public func cpclConcatText(fontGroup fontGroup: Int, offset: Int, text: String)
11// Concat End
12public func cpclConcatEnd()
Parameter | Type | Description | Valid Range |
---|---|---|---|
X | 5 Digit Unit Number | The X origin of the text string. | 0 to 65535 |
Y | 5 Digit Unit Number | The Y origin of the text string. | 0 to 65535 |
Parameter | Type | Description | Valid Range |
---|---|---|---|
FontNameOrNumber | Space-Terminated String | A font name or number to create the text. | See Below. |
FontSize | 5 Digit Number | The size of the pre-scaled font. | 0 to 65535 |
Offset | 5 Digit Unit Number | How far from Y is the top of this text? | 0 to 65535 |
Data | CR-LF Terminated String | The text data to be concatenated. | Up to 2024 characters1 |
Parameter | Type | Description | Valid Range |
---|---|---|---|
ScaledFontName | Space-Terminated String | A scaled font used to create the text. | See Below. |
XPoints | 5 Digit Number | The X size of the scaled font, in points. | 0 to 65535 |
YPoints | 5 Digit Number | The Y size of the scaled font, in points. | 0 to 65535 |
Offset | 5 Digit Unit Number | How far from Y is the top of this text? | 0 to 65535 |
Data | CR-LF Terminated String | The text data to be concatenated. | Up to 2024 characters1 |
Parameter | Type | Description | Valid Range |
---|---|---|---|
FontGroupNumber | Space-Terminated String | The number of the font-group to use | 0 to 10 |
Offset | 5 Digit Unit Number | How far from Y is the top of this text? | 0 to 65535 |
Data | CR-LF Terminated String | The text data to be concatenated. | Up to 2024 characters1 |
1cpclLabel(offset: 0, hRes: 200, vRes: 200, height: 210, quantity: 1)
2cpclText(rotate: 0, font: 0, fontSize: 2, x: 0, y: 0, text: "concat command")
3cpclConcatStart(xPos: 0, yPos: 90)
4cpclConcatText(font: 4, fontSize: 0, offset: 10, text: "$")
5cpclConcatText(font: 4, fontSize: 1, offset: 20, text: "12")
6cpclConcatText(font: 1, fontSize: 2, offset: 30, text: "34")
7cpclConcatText(font: 8, fontSize: 0, offset: 60, text: "Hello")
8cpclConcatText(font: 9, fontSize: 1, offset: 90, text: "World")
9cpclConcatEnd()
10cpclPrint()
- The
COUNT
command is used to increment or decrement a field on a label when the labels are printed in a batch, that is with a quantity greater than one on in the label session definition.- COUNT fields are not cleared at the start of each new label session. If you try to use COUNT on an unsupported field, or use COUNT without a field, and you previously adjusted a field successfully, the old field definition will be used for the second label and on in the batch (adjusts don’t take effect until the second label)
- No more than 30 COUNT commands can appear in a single label session. Any beyond this amount will have no effect.
1// 计数,加减条码文本数据段数值
2public func cpclCount(adjust: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Adjust | The amount to adjust the field. | Up to 20 ASCII digits, signed |
1cpclLabel(offset: 0, hRes: 200, vRes: 200, height: 210, quantity: 3)
2cpclAnnotation("Print 3 labels")
3cpclCenter()
4cpclText(rotate: 0, font: 4, fontSize: 0, x: 0, y: 50, text: "testing 001")
5cpclCount(1) // 计数,加减条码文本数据段数值
6cpclText(rotate: 0, font: 4, fontSize: 0, x: 0, y: 100, text: "barcode value is 123456789")
7cpclCount(-10)
8cpclBarcode(type: CPCLBarcodeType.Code128.rawValue, width: 1, ratio: 1, height: 50, x: 0, y: 150, barcode: "{A123456789")
9cpclCount(-10)
10cpclPrint()
END
is used to terminate a CPCL label session, and create the resulting print out.- Every CPCL label session must be terminated with a PRINT command.
- Every example for this section uses the PRINT command to terminate labels.
1 // 功能完全一样,End 是 Print 的别名
2 public func cpclPrint()
3 public func cpclEnd()
1cpclLabel(offset: 0, hRes: 200, vRes: 200, height: 210, quantity: 1)
2cpclCenter()
3cpclText(rotate: 0, font: 4, fontSize: 0, x: 10, y: 0, text: "This is a ! command.")
4cpclPrint()
- The
EXPANDED-GRAPHICS
command is used to print ASCII encoded bitmap data to the label.
EXPANDED-GRAPHICS
is the same except it is oriented vertically.
- Unless the communication method does not permit the use of binary data, graphical data is more efficiently represented by using the
COMPRESSED-GRAPHICS
command.
1public func cpclExpandedGraphics(byteWidth byteWidth: Int, height: Int, xPos: Int, yPos: Int, bitmapData: NSData)
2public func cpclExpandedGraphicsVertical(byteWidth byteWidth: Int, height: Int, xPos: Int, yPos: Int, bitmapData: NSData)
Parameter | Type | Description | Valid Range |
---|---|---|---|
ByteWidth | 3 Digit Number | The byte width of the image being transmitted. | 0 to 999 |
Height | 5 Digit Number | The height of the data to follow in units. | 0 to 65535 |
X | 5 Digit Number | The X origin of the graphic. | 0 to 65535 |
Y | 5 Digit Number | The Y origin of the graphic. | 0 to 65535 |
Data | Raw String | The data that makes up the bitmap to be printed. | See below. |
FONT-GROUP
is used to define groups of pre-scaled fonts which can be used to for automatic font size calculation when used with various text commands in CPCL.- Up to a total of 10 font groups can be defined, numbering from 0 to 9. Each
FONT-GROUP
command defines a single font group, which an in turn contain up to 10 pairs of font name or number and size values. These values are repeated as many times as desired in the FONT-GROUP command before being CR-LF terminated. At least one pair must be specified to define the group, though two or more is recommended.- When a text command using a font group is used, the printer will automatically select a font from the font group which allows the text to fit in the area from the X and Y coordinates specified in the text command to the edge of the label area as defined by the
PAGE-WIDTH
command.- In order to make the text fit, the printer can not only select any of the fonts, but can change the spacing of the font, decreasing the space between characters to attempt to make it fit. If, even after decreasing the spacing to a minimal amount, the text will not fit, the text command is aborted and no text is printed all for that text command.
- Font groups are supported in the
TEXT
andCONCAT
commands in CPCL. Font groups do work with the MULTILINE command, however only one member of the font group is selected for the entireMULTI-LINE
set, based on the font size needed for the widest line of text in the MULTI-LINE group.- Once defined in a label or utilities session, a font group remains defined until power is cycled. By default at power on, no font groups are defined.
1public func cpclFontGroup(group: Int, font: Int, size: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Group | 5 Digit Number | Specifies the group number to define | 0 to 9 |
FontNameOrNumber | Space-Terminated String | A font name or number to create the representation | See Below. |
FontSize | 5 Digit Number | The size of the font. | 0 to 65535 |
IMAGE
is used to change the drawing method of pre-scaled text commands andLINE
commands.- By default, image data drawn to a label ORed with existing label data, that is if there is already a black dot at the location being drawn to, the dot will continue to appear black.
- By using the IMAGE command, you can change this behavior to XOR new drawing with existing label data, which means that if there is an existing black dot at the location being drawn to, the dot will be erased and replaced with a white dot.
- IMAGE is persistent between labels, with the most recent setting in either a label or utilities session taking precedence. It can be changed as many times as needed per label.
1public func cpclImageMode(mode: String)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Mode | CR-LF Terminated String | Specifies the drawing mode | OR or XOR |
- The various IN- commands change the system of measurement for all parameters in CPCL which are identified as unit numbers to centimeters. At the beginning of each new label, the system is reset to dots (the equivalent of the IN-DOTS command).
- If any of these commands are the very first one in a label session, the session definition’s height parameter is re-evaluated in the new system of measurement. Otherwise the command only affects subsequent fields in the label session.
- You can change the system of measurement as many times as necessary per label.
1public func cpclInCentimeters()
2public func cpclInDots()
3public func cpclInChes()
4public func cpclInMillimeters()
Requested Unit | Conversion Factor to Dots |
---|---|
Dots (Default) | 1 |
Centimeters | 80 |
Millimeters | 8 |
Inches | 203.2 |
- The
INVERSE-LINE
command is used to draw a line which inverts the label area over which it is drawn.- LINE has two modes of operation based on whether or not one side of the line is flat.
- If the line is straight (X and EndX are the same or Y and EndY are the same), you can align the line using the
CENTER
,LEFT
andRIGHT
commands.- If the line is diagonal, it cannot be aligned or filled.
1public func cpclInverseLine(xPos xPos: Int, yPos: Int, xEnd: Int, yEnd: Int, thickness: Int)
2public func cpclReverseLine(xPos xPos: Int, yPos: Int, xEnd: Int, yEnd: Int, thickness: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
X | 5 Digit Unit Number | The X origin of the line. | 0 to 65535 |
Y | 5 Digit Unit Number | The Y origin of the line. | 0 to 65535 |
EndX | 5 Digit Unit Number | The X coordinate where the line ends. | 0 to 65535 |
EndY | 5 Digit Unit Number | The Y coordinate where the line ends. | 0 to 65535 |
Thickness | 5 Digit Unit Number | The thickness of the line. | 0 to 65535 |
- The LEFT command is used to change the justification of supported fields. It is part of a series of justification commands which includes
LEFT
,CENTER
andRIGHT
.- LEFT is the default justification for labels. Each time a new label session is started, it is set to LEFT alignment (specifically LEFT 0). Once used, LEFT is persistent within the label session.
1public func cpclLeft(range: Int)
2public func cpclLeft()
3
4public func cpclCenterWithRange(range: Int)
5public func cpclCenter()
6
7public func cpclRight(range: Int)
8public func cpclRight()
Parameter | Type | Description | Valid Range |
---|---|---|---|
Range | 5 Digit Unit Number | Sets FONT-GROUP field width. | 0 to 65535 |
The following commands support justification:
BARCODE (all 1D types) | BARCODE MAXICODE | BOX |
---|---|---|
CONCAT | INVERSE-LINE, REVERSE-LINE | LINE |
PCX, PCX90, PCX180, PCX270 | PCXMAG | SCALE-TEXT |
SCALE-TO-FIT | TEXT, TEXT90, TEXT180, TEXT270 | COMPRESSED-GRAPHICS, EXPANDED- GRAPHICS |
1cpclLabel(offset: 0, hRes: 200, vRes: 200, height: 500, quantity: 1)
2cpclCenter()
3cpclText(rotate: 0, font: 4, fontSize: 0, x: 0, y: 0, text: "center")
4cpclLeft()
5cpclText(rotate: 0, font: 4, fontSize: 0, x: 0, y: 50, text: "left")
6cpclRight()
7cpclText(rotate: 0, font: 4, fontSize: 0, x: 0, y: 100, text: "right")
8cpclCenterWithRange(200)
9cpclText(rotate: 0, font: 4, fontSize: 0, x: 0, y: 150, text: "center 200")
10cpclRight(200)
11cpclText(rotate: 0, font: 4, fontSize: 0, x: 0, y: 200, text: "right 200")
12cpclLeft()
13cpclText(rotate: 0, font: 4, fontSize: 0, x: 0, y: 250, text: "left 200")
14cpclPrint()
- The
LINE
command is used to draw a line.- LINE has two modes of operation based on whether or not one side of the line is flat.
- If the line is straight (X and EndX are the same or Y and EndY are the same), you can align the line using the CENTER, LEFT and RIGHT commands. You can also use the
PATTERN
command to fill the line with a pattern. The PATTERN command can be used to create white lines.- If the line is diagonal, it cannot be aligned or filled.
1public func cpclLine(xPos xPos: Int, yPos: Int, xEnd: Int, yEnd: Int, thickness: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
X | 5 Digit Unit Number | The X origin of the line. | 0 to 65535 |
Y | 5 Digit Unit Number | The Y origin of the line. | 0 to 65535 |
EndX | 5 Digit Unit Number | The X coordinate where the line ends. | 0 to 65535 |
EndY | 5 Digit Unit Number | The Y coordinate where the line ends. | 0 to 65535 |
Thickness | 5 Digit Unit Number | The thickness of the line. | 0 to 65535 |
- The
MOVE
command moves the origin of a label. The effect is most pronounced when using a media that synchronizes to marks. It does affect continuous mode labels, but the effects may be difficult to see, particularly with the MoveUp parameter.
- The values specified by MOVE are added to those specified by
TEMP-MOVE
to determine the final position. Note that TEMP-MOVE and MOVE are both negative aware. This means that if a MOVE 20 20 was in effect, and a TEMP-MOVE -20 -20 was also in effect, the net location used would be 0,0.- The MOVE command is available in both label and utilities sessions and is persistent between labels, but is reset when the printer is power cycled.
1public func cpclMove(right right: String, up: String)
Parameter | Type | Description | Valid Range |
---|---|---|---|
MoveRight | 5 Digit Unit Number | How far to move the label to the right. | 0 to 65535 |
MoveUp | 5 Digit Unit Number | How far to move the label up. | 0 to 65535 |
- The
MULTILINE
command is used to print a number of lines of text using the same font without having to manually specify the spacing or positioning of each line.- The basic format of the command is the MULTILINE command followed by LineHeight and then a fully formed text command without its final parameter which would specify the data to print, followed by a CR and LF.
- After that, as many Data lines as necessary can be specified without limit. Each field will be printed as if it was an individual text command, with the vertical position increasing by LineHeight for each line.
1public func cpclMultiLineStart(lineHeight lineHeight: Int)
2...
3public func cpclInsertTextLine(textLine: String)
4...
5public func cpclMultiLineEnd()
Parameter | Type | Description | Valid Range |
---|---|---|---|
LineHeight | 5 Digit Unit Number | Spacing between each line in units. | 0 to 65535 |
TextCommand | Command | A command specifying formatting for the text. | See Below. |
Data | CR-LF Terminated String | A text line to print using the formatting. | See Below. |
the following text commands are supported for use with MULTILINE.
- TEXT, TEXT90, TEXT180, TEXT270, VTEXT, T, T90,T180,T270, VT
- SCALE-TO-FIT, VSCALE-TO-FIT, STF, VSTF
- SCALE-TEXT, VSCALE-TEXT, ST, VST
1cpclLabel(offset: 0, hRes: 200, vRes: 200, height: 228, quantity: 1)
2cpclMultiLineStart(lineHeight: 40)
3cpclText(rotate: 0, fontGroup: 1, x: 0, y: 0, text: "10")
4cpclInsertTextLine("line 1")
5cpclInsertTextLine("line 2")
6cpclInsertTextLine("line 3")
7cpclInsertTextLine("line 4")
8cpclMultiLineEnd()
9cpclPrint()
- The PAGE-WIDTH command is used to specify the width a label session. The height of the session is defined in the session header.
- Some printers have built-in sensors to detect the width of the currently installed media. If this sensor is installed and enabled, setting a PAGE-WIDTH of 0 will use the detected media width for the label.
- The PAGE-WIDTH command must either be used in a utilities session, or before any command which creates output on the label is used. If used in a label session, it should be the first command after the session line (or the second if you are using a units command such as IN-CENTIMERES to modify the session line).
- It is not recommended to change PAGE-WIDTH once you have started drawing to the label, as any fields drawn so far will become corrupted.
1public func cpclPageWidth(width: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Width | 5 Digit Unit Number | Spacing between each line in units. | 0 to 65535 |
- The
PATTERN
command is used to change the fill patterns of theSCALE-TEXT
andSCALE-TO-FIT
(when using CSF fonts only), some LINE commands (must be horizontal or vertical lines), and all BOX commands.
- By default and at the start of each label session, PATTERN is set to 100, which is solid black. PATTERN is persistent within the same label session.
- Lines or boxes drawn with PATTERN values besides 100 start and end one dot higher than their pixel position indicates. This behavior does not occur with SCALE-TEXT.
1public func cpclPatternNumber(patternNumber: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Pattern | 5 Digit Number | The pattern number to use | 0 to 106 |
- The
PCX
command is used to print a ZSoft PCX file.- The PCX file must be a 2-color, 1-plane RLE-encoded PCX file. If it is not, command is aborted and the binary data of the PCX flows into the label data, often causing the printer to enter an unpredictable state.
- PCX supports the justification commands LEFT, RIGHT and CENTER, but if the PCX is too wide to fit on the current label (as determined with
PAGE-WIDTH
), no image will be printed at all. This does not occur if the image is too tall – it will be properly clipped in this case.- The origins of the rotated versions of the PCX commands (
PCX90
,PCX180
andPCX270
) do not use the same math for their origins as TEXT and other commands do. See the example for more details.
1public func cpclPCX(rotation rotation: Int, xPos: Int, yPos: Int, bitmapData: NSData)
Parameter | Type | Description | Valid Range |
---|---|---|---|
X | 5 Digit Unit Number | The X origin of the PCX. | 0 to 65535 |
Y | 5 Digit Unit Number | The Y origin of the PCX. | 0 to 65535 |
Data | Raw String | Binary data containing the PCX file | See below. |
- The
PCXMAG
command is used to print a ZSoft PCX file that has been magnified vertically and horizontally.- The requirements for the PCX file itself are identical to the
PCX
command. The only difference between this command and PCX is the addition of the magnification parameters.- PCXMAG supports the justification commands LEFT, RIGHT and CENTER. Unlike with PCX, if the image flows off the right side of the page, it does not wrap, the remainder of the image data is disposed of.
- If the unscaled image is too wide to fit on the page (as defined by page width), no image will be printed.
- The use of alignment commands (RIGHT and CENTER) with PCXMAG is not supported.
1public func cpclPCXMAG(xPos xPos: Int, yPos: Int, XMag: Int, YMag: Int, bitmapData: NSData)
Parameter | Type | Description | Valid Range |
---|---|---|---|
X | 5 Digit Unit Number | The X origin of the PCX. | 0 to 65535 |
Y | 5 Digit Unit Number | The Y origin of the PCX. | 0 to 65535 |
XMag | 5 Digit Unit Number | The X magnification factor of the PCX | 0 to 65535 |
YMag | 5 Digit Unit Number | The Y magnification factor of the PCX | 0 to 65535 |
Data | Raw String | Binary data containing the PCX file | See below. |
- PERSIST is used to determine if label memory is erased at the end of each label session. By default, when a label session ends, the label memory is cleared. This option can be changed so that the image of the last label is retained and merged with any subsequent label commands.
- The setting is preserved between label sessions, but is always set to OFF at startup.
1public func cpclPersist(option: String)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Option | When set to ON, label images persist | ON or OFF |
- The
ROTATE
command is used to specify the rotation of a scalable or TrueType font within the printer.- ROTATE can also be used with any of these commands when they are part of a
MULTI-LINE
session, but not within the MULTI-LINE session itself.- For all of these commands, if the rotated text extends off the top or right edge of the label, the text will be truncated, and the final character on the line may not be fully formed. In the left and bottom direction, a fully formed partial character will be printed instead.
SCALE-TO-FIT
andCONCAT
does not support use of the ROTATE command with TrueType fonts.
1public func cpclRotate(degrees: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Degrees | 5 Digit Number | The number of degrees to rotate counter-clockwise | 0 to 65535 |
The following commands support rotation
- CONCAT, VCONCAT
- SCALE-TEXT, VSCALE-TEXT
- SCALE-TO-FIT, VSCALE-TO-FIT
- The
SCALE-TEXT
command is used print scaled text in CPCL from either a scaled or TrueType font.VSCALE-TEXT
has the same functionality, but orients the text rotated 90 degrees.- When the text generated by SCALE-TEXT flows off the edge of the page, it does not wrap. On the top edge it is truncated to the nearest character that will fully fit (when using VSCALE-TEXT). On the right edge, it is truncated to at the last pixel of the page width, including any partial characters.
1public func cpclScaleText(scaledFont: String, xScale: Int, yScale: Int, x: Int, y: Int, text:String)
2public func cpclScaleTextVertical(scaledFont: String, xScale: Int, yScale: Int, x: Int, y: Int, text:String)
Parameter | Type | Description | Valid Range |
---|---|---|---|
ScaledFontName | Space-Terminated String | A scaled font used to create the text. | See Below. |
XPoints | 5 Digit Number | The X size of the scaled font, in points. | 0 to 65535 |
YPoints | 5 Digit Number | The Y size of the scaled font, in points. | 0 to 65535 |
X | 5 Digit Unit Number | The X origin of the scaled text in units. | 0 to 65535 |
Y | 5 Digit Unit Number | The Y origin of the scaled text in units. | 0 to 65535 |
Data | CR-LF Terminated String | The text data to be printed. | Up to 8191 characters. |
- The
SCALE-TO-FIT
command is used print scaled text which is to fit within a particular bounding box in CPCL. The command is similar in syntax to theSCALE-TEXT
command, but the difference is that the sizing parameters XScale and YScale are now replaced with Width and Height. The font’s vertical and horizontal size will be selected to fit within the box specified.SCALE-TO-FIT
can be used with TrueType or scaled fonts.VSCALE-TO-FIT
has the same functionality, but orients the text rotated 90 degrees.- Because
SCALE-TO-FIT
can only contain a single line of text, the height of the output text is always Height.
1public func cpclScaleToFit(scaleFont: String, width: Int, height: Int, x: Int, y: Int, text: String)
Parameter | Type | Description | Valid Range |
---|---|---|---|
ScaledFontName | Space-Terminated String | A scaled font used to create the text. | See Below. |
Width | 5 Digit Unit Number | The width of the box to contain the text. | 0 to 65535 |
Height | 5 Digit Unit Number | The height of the box to contain the text. | 0 to 65535 |
X | 5 Digit Unit Number | The X origin of the scaled text in units. | 0 to 65535 |
Y | 5 Digit Unit Number | The Y origin of the scaled text in units. | 0 to 65535 |
Data | CR-LF Terminated String | The text data to be printed. | Up to 8191 characters. |
SET BOLD
is used to add a faux bolding effect to pre-scaled fonts in CPCL. It accomplishes this by redrawing the text one or more times, shifting one pixel to the right side of the page each time. The spacing of the characters does not change as a result of the bolding.- The number of shifts and writes is specified by the Boldness parameter.
- The command affects any pre-scaled text drawing in CPCL, no matter what command it comes from.
1public func cpclSetBold(boldness: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Boldness | 3-digit Unit Number | Sets the boldness of the text. | 0 to 999 |
SETMAG
is used to set the output scaling of pre-scaled fonts, overriding the sizing behaviors defined in the font files themselves. When a non-zero value for SETMAG is used, that value replaces that element in the sizing of all pre-scaled fonts, regardless of what command is used to draw them.- SETMAG’s value is preserved between labels, and also shared with line print mode.
1public func cpclSetMag(width width: Int, height: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Width | 3-digit Number | Sets the width multiplier of the font. | 0 to 16 |
Height | 3-digit Number | Sets the height multiplier of the font. | 0 to 127 |
1cpclLabel(offset: 0, hRes: 200, vRes: 200, height: 500, quantity: 1)
2cpclText(rotate: 0, font: 0, fontSize: 0, x: 0, y: 0, text: "Text")
3cpclText(rotate: 0, font: 0, fontSize: 1, x: 0, y: 30, text: "T90")
4cpclText(rotate: 0, font: 0, fontSize: 2, x: 0, y: 90, text: "T180")
5cpclText(rotate: 0, font: 0, fontSize: 3, x: 0, y: 120, text: "T270")
6
7cpclSetMag(width: 2, height: 2)
8cpclText(rotate: 0, font: 0, fontSize: 0, x: 0, y: 180, text: "text")
9cpclText(rotate: 0, font: 0, fontSize: 1, x: 0, y: 250, text: "T90")
10cpclText(rotate: 0, font: 0, fontSize: 2, x: 0, y: 330, text: "T180")
11cpclText(rotate: 0, font: 0, fontSize: 3, x: 0, y: 400, text: "T270")
12cpclPrint()
SETSP
is used to set the horizontal spacing between characters. The command adjusts the spacing of both pre-scaled and scaled fonts. The command can only increase the spacing between characters, it cannot decrease it.- If the spacing is large enough, this may cause the text to flow off the edge of the page. In this case, what happens to the extra text is a function of the underlying command used to print the text (i.e. wraps with TEXT, is truncated with
SCALE-TEXT
).- SETSP is not supported for TrueType fonts.
- SETSP is reset at the start of each label to 0 for pre-scaled fonts. It is not reset for scaled fonts.
1public func cpclSetSpacing(spacing: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Spacing | 3-digit Unit Number | Sets the spacing between characters of a font | See Below. |
- The
TEMP-MOVE
command moves the origin of the next or current label session. The effect is most pronounced when using a media that synchronizes to marks. It does affect continuous mode labels, but the effects may be difficult to see, particularly with the MoveUp parameter.- The TEMP-MOVE command is available in both label and utilities sessions, and only applies to the next or current label session. After the session ends, TEMP-MOVE is reset to zero.
- The values specified by TEMP-MOVE are added to those specified by
MOVE
to determine the final position. Note that TEMP-MOVE and MOVE are both negative aware. This means that if a MOVE 20 20 was in effect, and a TEMP-MOVE -20 -20 was also in effect, the net location used would be 0,0.- Syntax and functionality wise, TEMP-MOVE is identical to MOVE.
1public func cpclTempMove(right: Int, up: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
MoveRight | 5 Digit Unit Number | How far to move the label to the right. | 0 to 65535 |
MoveUp | 5 Digit Unit Number | How far to move the label up. | 0 to 65535 |
- The
TEXT
command is used to print text in CPCL. The command can be used with both pre-scaled and TrueType fonts, but not with scalable fonts (useSCALE-TEXT
for these instead). The TEXT command can also be used to print using font groups.- There are three syntaxes to the command. The first is for pre-scaled fonts, the second for TrueType fonts, and the third is for font group.
- The alignment commands CENTER, LEFT and RIGHT are supported for all forms of the TEXT command.
1// Pre-scaled Font Syntax
2public func cpclText(rotate rotate: Int, font: Int, fontSize: Int, x: Int, y: Int, text: String)
3// Alternate Syntax -TTF Font Syntax
4public func cpclText(rotate rotate: Int, trueTypeFont: Int, xScale: Int, yScale: Int, x: Int, y: Int, text: String)
5// Alternate Syntax -Font-Group
6public func cpclText(rotate rotate: Int, fontGroup: Int, x: Int, y: Int, text: String)
Parameter | Type | Description | Valid Range |
---|---|---|---|
FontNameOrNumber | Space-Terminated String | A font name or number to create the representation | See Below. |
FontSize | 5 Digit Number | The size of the font. | 0 to 65535 |
X | 5 Digit Unit Number | The X origin of the text in units. | 0 to 65535 |
Y | 5 Digit Unit Number | The Y origin of the text in units. | 0 to 65535 |
Data | CR-LF Terminated String | The text data to be printed. | Up to 8191 characters |
Parameter | Type | Description | Valid Range |
---|---|---|---|
TrueTypeFontName | Space-Terminated String | The filename of the TTF font with extension | See Below. |
XScale | 5 Digit Number | The X size of the font, in dots. | 10 to 1450 |
YScale | 5 Digit Number | The Y size of the font, in dots | 10 to 1450 |
X | 5 Digit Unit Number | The X origin of the text in units. | 0 to 65535 |
Y | 5 Digit Unit Number | The Y origin of the text in units. | 0 to 65535 |
Data | CR-LF Terminated String | The text data to be printed. | Up to 8191 characters |
Parameter | Type | Description | Valid Range |
---|---|---|---|
FontGroupNumber | Space-Terminated String | The number of the font-group to use | 0 to 10 |
X | 5 Digit Unit Number | The X origin of the text in units. | 0 to 65535 |
Y | 5 Digit Unit Number | The Y origin of the text in units. | 0 to 65535 |
Data | CR-LF Terminated String | The text data to be printed. | Up to 8191 characters |
1cpclLabel(offset: 0, hRes: 200, vRes: 200, height: 210, quantity: 1)
2cpclLabel(offset: 0, hRes: 200, vRes: 200, height: 200, quantity: 1)
3cpclText(rotate: 0, font: 4, fontSize: 0, x: 200, y: 100, text: "Text")
4cpclText(rotate: 90, font: 4, fontSize: 0, x: 200, y: 100, text: "T90")
5cpclText(rotate: 180, font: 4, fontSize: 0, x: 200, y: 100, text: "T180")
6cpclText(rotate: 270, font: 4, fontSize: 0, x: 200, y: 100, text: "T270")
7cpclPrint()
The
MARGIN
command is used to offset line print printing by a fixed amount. This command affects all data printed via line print text or any utilities command which results in printout.
1public func cpclLineMargin(offset: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Offset | 3 Digit Unit Number | Specifics the distance from the left edge in units | 0 to 999 |
- the
LP-LF-EQUALS-CRLF
command is used to tell the printer that when printing line print text, the LF character is equivalent to the two characters CR and LF.- This command only applies to line print text; it has no effect on any other part of the printer’s operation.
- The value is persistent until reboot or until changed. The default value is OFF.
1public func cpclLinePrintSetLF(option: String)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Option | Space terminated string | Specifies the enable or disable of the function | ON or OFF |
- The
LP-ORIENT
command is used to specify if line print operates in standard mode, or in rotated mode.- The implementation of LP-ORIENT is such that the data received is only reversed and rotated, and as such, to create readable text, significant modification of the format of the text is required before transmission to the printer to make it readable. See the example for an indication on how to send the data.There is only one rotation supported which is 270 degrees.
- The only other supported option is 0, which is the power on default. The value specified is retained until it is changed or the printer’s power is cycled.
- Only line print text is affected by the LP-ORIENT command. When using LP-ORIENT 270, the LMARGIN and
SETLF
commands have no effect; theMARGIN
is fixed at 0, and SETLF is forced to 10.- When using LP-ORIENT 270, the height of the page is determined by the number of lines transmitted.
- LP-ORIENT 270 is not supported for TrueType fonts.
1public func cpclLinePrintOrient(option: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Option | Space terminated string | Specifies the amount of rotation | 0 or 270 |
- RX, RY, and RXY are used in line print mode to specify that an element should be positioned relative to the line print text element printed. The command can be used at any time to adjust the line print cursor position, even in the middle of a string of line print characters.
- This command only impacts line print text and the
g command. It has no effect on labels or utilities-based line print commands.
1 public func cpclLinePrintAdjust(xPos xPos: Int)
2 public func cpclLinePrintAdjust(yPos yPos: Int)
3 public func cpclLinePrintAdjust(xPos xPos: Int, yPos: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
XValue | 5 Digit Number | Specifies the value to use for the X position | -32767 to 32767 |
YValue | 5 Digit Number | Specifies the value to use for the Y position | -32767 to 32767 |
SETLF
is used in line print mode to set how much media is fed by the printer when the LF character is received by the printer.- At power on, this value is set to 10, which puts a space of 10 pixels between each row of line print printed characters. Note that this space is an addition to any space defined by the font itself, which is specified by the
SETLP
command on page 176. Any value set is persistent until reboot, except if the AUTOCAL command is run, which sets it to 0.- SETLF can perform an important function regarding the ability to print
PCX
images and barcodes in line print mode. When a barcode or PCX image is printed in line print, without any modifications, the maximum height of the output will be the value specified by SETLF (10 by default) plus the height value specified for SETLP (24 by default), or 34 pixels. Adjusting the SETLF value up allows a larger maximum height to be printed. See page 175 for an introduction to line print for more information.
1public func cpclSetLF(height: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Height | 5 digit Unit Number | Specifies the height fed when an LF is received | 0 to 32767 |
SETLP
is used to set the name or number and size of the font which is to be used for printing line print text. The font can either be a pre-scaled font or a TrueType font.- The default values for SETLP use the pre-scaled font syntax, and specify font number 7, size 0, and a line spacing of 24.
1// Pre-Scaled Font Syntax
2public func cpclSetLP(font font: Int, fontSize: Int, lineSpacing: Int)
3// Alternate Syntax - TTF Font Syntax
4public func cpclSetLP(trueTypeFont font: String, xScale: Int, yScale: Int, lineSpacing: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
FontNameOrNumber | Space-Terminated String | A font name or number to create the representation | See Below. |
FontSize | 3 Digit Number | The size of the font. | 0 to 65535 |
LineSpacing | 5 Digit Unit Number | The amount of space to place between lines in units. | 0 to 65535 |
Parameter | Type | Description | Valid Range |
---|---|---|---|
TrueTypeFontName | Space-Terminated String | The filename of the TTF font with extension | See Below. |
XScale | 5 Digit Unit Number | The X size of the font, in units. | 10 to 1450 dots |
YScale | 5 Digit Unit Number | The Y size of the font, in units. | 10 to 1450 dots |
LineSpacing | 5 Digit Unit Number | The amount of space to place between lines in units. | 0 to 65535 |
SETLP-BUFFER
is used to set the height of the line print buffer. This buffer represents the maximum area that can be written to in a single line print transaction.- Typically the size of this buffer does not require adjustment because Link-OS CPCL will seamlessly join line print buffers while printing normal text or line print graphics.
- There are a small number of cases for which this command is needed however, such as printing a
PCX
or Barcode longer than the default SETLP-BUFFER size.- The default buffer at power on is 2400 dots. Any value set will remain active until it is changed or until reboot.
1public func cpclSetLPBuffer(height: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Height | 5 digit Unit Number | Specifies the size of the line print buffer in units. | 0 to 2400 dots |
SETLP-TIMEOUT
sets how long the printer waits for additional line print text data before forcing termination and printing of un-terminated data.- Normally lines in line print text are terminated with a CR, an LF or a CR and LF character. If data arrives which is not terminated with a CR or LF, this timeout specifies how long the printer will wait for more data before terminating the line and printing the data.
- Each time a character destined for line print is received, the timer is reset. In addition, the timer is reset when a line print barcode or
PCX
command is processed.- The default value at power on is 4 (representing 500ms). The value is persistent until power cycle or changed with this command. Setting this command to a value of 0 disables the line print timeout, and characters will be held forever until a terminator is received.
1public func cpclSetLPTimeout(timeout: Int)
Parameter | Type | Description | Range |
---|---|---|---|
Timeout | 5-digit Number | Specifies line print timeout in 1/8th of a second increments | 0 to 99999 |
X
,Y
, andXY
are used in line print mode to specify that an element should be positioned. The command can be used at any time to adjust the line print cursor position, even in the middle of a string of line print characters.- This command only impacts line print text and the
g command. It has no effect on labels or utilities-based line print commands.
1public func cpclSetPosition(xPos xPos: Int, yPos: Int)
2public func cpclSetPosition(xPos xPos: Int)
3public func cpclSetPosition(yPos yPos: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
XValue | 5 Digit Number | Specifies the value to use for the X position | -32767 to 32767 |
YValue | 5 Digit Number | Specifies the value to use for the Y position | -32767 to 32767 |
is a line print character which is used to advance the cursor along the Y axis while not resetting the X axis. - The height advanced in the Y direction is specified by the SETLF command. By default, the value is 10,
1public func cpclLineFeed()
is a line print character which is used to advance the cursor along the Y axis and also reset the X axis to 0.
1public func cpclCarriageReturn()
- The
g command is used to print graphics in line print mode. - Each
g command is used to print a single pixel line of graphic data. The width of the line is specified in the first two bytes following the g command as a 16-bit integer. All current printers with CPCL only require a single byte to represent maximum width, though both bytes must be specified. - The design intent of the
g command is that the SETLP and SETLF commands first be used to configure the total line height to 1 pixel, since each g command only prints one line at a time. g by itself will not affect any print out; the or commands must be used at the end of the line to terminate it. Generally this involves setting the LF height to 1 with the SETLF command, and setting the font height to 0 with the SETLP command. See the example below for more information. - The
g command positions its output at the current line print cursor location. The LMARGIN, RX, RY, RXY, X, Y and XY commands can all be used to control the position of the line print cursor. The LMARGIN command is often used to avoid having to specify large blocks of blank space at the start of lines. The RY command can be used to easily skip areas of blank paper without having to send large amounts of NUL data.
1public func cpclLinePrintGraphics(byteWidth byteWidth: Int, bitmapData: NSData)
Parameter | Type | Description | Valid Range |
---|---|---|---|
ByteWidth | 2 Byte Binary Number | The byte width of the data for this dot line | 0 to 104 in practice |
Data | Raw String | The data that makes up the bitmap to be printed. | See below. |
- CPF and ECPF fonts both begin with a human readable file header, followed by binary data. The header contains identification information and the size table mentioned above. All CPF fonts begin with the text CISBF. This identifies the file as a font.
- At startup, all files on the printer are checked for this header, and if it is found, the printer attempts to load them as CPF fonts.
- The items beginning with a dash may appear in any order in the font file (although the
–END-FONT-INF
must be at the end)
1public func cpclFileHeader(description description: Int, fontNumber: Int, sizeOut: Int)
2public func cpclFileHeaderDefineScalingFactor(heightMult heightMult:Int, widthMult: Int, pageOffset: Int)
3public func cpclEndOfHeaderDesignation()
Field Name | Description | Type | Valid Range |
---|---|---|---|
Description | Description of the font file. | Up to 30 characters | |
FontNumber | The font number, optional. | 8 to 63 | |
SizeCount | The number of entries in the sizes table. | 1 to 255 | |
HeightMult | The height scaling factor of this size. | Space Terminated String | 0 to 65535 |
WidthMult | The width scaling factor of this size. | Space or CRLF Terminated | 0 to 65535 |
PageOffset | The address location of the bitmaps | 4 binary bytes (uint32) | All values valid. |
- This command is used to set the encoding for CPF, CSF and TTF fonts in CPCL. For more information about the various internal supported options, see the previous section.
- Besides the list of internally supported encodings, custom encodings from ZPL can also be used in CPCL by using the filename in place of the Name option above. These files are referred to by the filename, without their extension, which must be .DAT. See the ZPL documentation for more information on custom character mappings.
1public func cpclCountry(country: String)
Name | Encoding Type |
---|---|
BIG5 | BIG5 Encoding. TTF maps to UTF points, multi byte. |
CHINA | EUC-CN Encoding, TTF maps to UTF points, multi byte. |
CP850 | USA with substitutions, single byte. Box and graphics chars not supported. |
CP874 | Font defines encoding for CPF, TTF maps to UTF points. , single byte. |
FRANCE | USA with 7-bit substitutions, single byte. |
GERMANY | USA with 7-bit substitutions, single byte. |
ITALY | USA with 7-bit substitutions, single byte. |
JAPAN | GBK Encoding, TTF maps to UTF points, multi byte. |
JAPAN-S | GBK Encoding. TTF maps to UTF points, multi byte. |
KOREA | GBK Encoding, TTF maps to UTF points, multi byte. |
LATIN9 | USA with substitutions, single byte. |
NORWAY | USA with 7-bit substitutions, single byte. |
SPAIN | USA with 7-bit substitutions, single byte. |
SWEDEN | USA with 7-bit substitutions, single byte. |
THAI | Thai multi-byte encoding. Superseded by CP874. |
UK | USA with 7-bit substitutions, single byte. |
USA | Font defines encoding, single byte. |
VIETNAM | Font defines ECPF encoding, TTF maps to UTF points, multi byte. |
- The
AUTODIAL
command is used to calibrate the detection thresholds of the printer based on the currently selected media type.- By default, the printer is preset to calibration thresholds of 70 for mark\bar media and 50 for gap media. These values are selected to be compatible with a wide range of medias, however if the media is unusual performance may be improved through this calibration process. The current values are viewable on the two-key report . The command uses two labels worth of media to perform the calibration.
1public func cpclAutoCal()
- For printers which have the peeler accessory, the
AUTO-PACE
activates the use of the peeler sensor, and will cause the printer to print one label, and then wait for its removal before printing the next label, which can be part of a batch, or can be a single quantity label. The batch is defined by the quantity parameter which is part of the label session definition. See page 18 for more information on the label session.- No other printing operations will occur while the printer is waiting for the label to be taken, including line print or prints from other languages.
- On some models, the peeler sensor must be physically activated before it can be used, and not all models have the peeler accessory. See your user manual for more information. On printers which do not have the peeler accessory, AUTO-PACE acts the same as the PACE command.
1public func cpclAutoPace(delay: Int)
2public func cpclAutoPace()
Parameter | Type | Description | Valid Range |
---|---|---|---|
Delay | 5 Digit Unit Number | How long to delay in 0.125 second increments | 0 to 65535 |
- The
BAR-SENSE
command is used to configure the system to use the reflective sensor for detecting media and synchronization marks. This is the recommended setting for media with marks, and for continuous media. This command is the opposite ofGAP-SENSE
.- BAR-SENSE takes an optional parameter which is used to set the detection threshold.
- Once set, either in a label or utilities session, it is persistent for all subsequent labels until power off. The setting (as well as the threshold) can be made permanent using the zpl.save SGD. See the examples for more information.
- The setting is shared with the ZPL setting specified by ^MN, and is equivalent to ^MNM.
1public func cpclBarSense(threshold: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Threshold | 5 Digit Unit Number | Media detection threshold for bar media | 0 to 255 |
- The
CONTAST
command is a legacy form of print darkness adjustment which gives a coarse adjustment to the darkness of printed labels. Setting CONTRAST temporarily sets the print.contrast SGD to the value provided.- The
TONE
command provides significantly more granularity for configuring the darkness of printed labels.- TONE and CONTRAST are unique settings in CPCL, and are not interchangeable.
- The value set for TONE overrides CONTRAST if the value of TONE is not zero. This includes if the SGD print.tone is set to a value other than zero, even during if no CPCL TONE command has been issued.
- In order for CONTRAST to have any effect, TONE must be zero.
- The default value for CONTRAST is 0, but at power on the current CONTRAST value is set to the value of the print.contrast SGD.
1public func cpclContrast(value: Int)
CONTRAST value | TONE Value | ~SD Value |
---|---|---|
0 | 0 | 10 |
1 | 100 | 20 |
2 | 200 | 30 |
3 | 200 | 30 |
- The FEED command is used to move media the specified amount as soon as the command is processed.
- FEED can be used with both negative and positive numbers. Note that there is no mechanism that prevents you from feeding an excessively large negative value causing the printer to lose control of the media.
- The FEED operation will ignore all gap or marks on the paper but will terminate if the printer detects an out of media condition or other error.
1public func cpclFeed(amount: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Amount | 5 Digit Unit Number | How much to feed in units. | -4000 to 4000 dots |
- The
FORM
command, when used in a label session, signals that after the label session is close withEND
, and is done printing, the printer should attempt to synchronize to a mark or gap on the media after the label is printed, taking into account all adjustments (the TOF value fromSET-TOF
and label skip fromSETFF
).- The command may appear anywhere in the label session but always applies at the end. The command is not persistent and must appear in each label session in order to take effect.
- The printer will search for the distance specified by the
SETFF
command (or by the media.feed_length SGD) for the mark before giving up. No error occurs if the printer cannot find the mark.- This differs from the command when used in a utilities session, which is covered in the next section.
1public func cpclForm()
1cpclLabel(offset: 0, hRes: 200, vRes: 200, height: 210, quantity: 1)
2cpclCenter()
3cpclText(rotate: 0, font: 4, fontSize: 0, x: 10, y: 0, text: "This is a FORM command.")
4cpclForm()
5cpclPrint()
- The GAP-SENSE command is used to configure the system to use the transmissive sensor for detecting media and synchronization marks. This is the recommended setting for media with gaps or notches. This command is the opposite of BAR-SENSE.
- GAP-SENSE takes an optional parameter which is used to set the detection threshold.
- Once set, either in a label or utilities session, it is persistent for all subsequent labels until power off. The setting (as well as the threshold) can be made permanent using the zpl.save SGD. See the examples for more information.
1public func cpclGapSense(threshold: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Threshold | 5 Digit Unit Number | Media detection threshold for gap media | 0 to 255 |
The
JOURNAL
command (and the associated LABEL command) determine which of the two modes of operation are used when a mark or gap is encountered while a label is being printed after a label session is completed.
1public func cpclJournal()
The
LABEL
command (and the associatedJOURNAL
command) determine which of the two modes of operation are used when a mark or gap is encountered while a label is being printed after a label session is completed.
1public func cpclLabel()
MUTLI
is used to set the number of labels which print horizontally across the page. The horizontal labels are exact duplicates across the page; it is not possible to specify unique content for each horizontal label.- When MULTI is active with a value of 2 or 3, the maximum print width is divided by the factor specified, and this becomes the new maximum value for the
PAGE-WIDTH
command.- Similar to
PAGE-WIDTH
, MULTI can affect the size of the drawing canvas when activated. For that reason, it is recommended to place theMULTI
command as the first item in the label session, before the PAGE- WIDTH or any drawing commands. Value of 2 and 3 are not supported on Epoch printers.- If used in a utilities session, the value specified applies only to line print, and is persistent. If used in a label session, the setting only applies to the current label being printed, and is not persistent.
- The
MULTI
command has no effect in line print if the text being printed is more than one line long.
1public func cpclMulti(quantity: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Quantity | 5 Digit Unit Number | How many labels to print across the page | 1 to 3 |
NO-PACE
terminates the use ofPACE
orAUTO-PACE
and disables any pause operation that occurs between prints.NO-PACE
is the default state for the printer at power on.- The command is always persistent when used. If used in a label session, it takes effect on the label that will be printed when the session ends and any subsequent sessions.
1public func cpclNoPace()
ON-OUT-OF-PAPER
is used to specify what happens when the printer runs out of paper, or encounters an unexpected mark or gap while printing a label in LABEL mode.- When the printer is used in LABEL mode, the printed area of the label should not encounter a mark or gap. Instead, the FORM command should be used after the label content is printed to synchronize to the end of the form. The label area defined in the label session should be 32 dots less than the actual size of the label to ensure proper functionality. If the printer detects a mark or gap while printing the label (not while using the
FORM
command), this command specifies what happens.- In addition, the command provides two separate configuration items regarding if the configuration applies to line print mode, and also specify an optional file to run when the end of form situation occurs unexpectedly.
- The default values for this command is PURGE 1, and
PURGE-LP OFF
, and RUN mode is disabled.- When RUN mode is activated, PURGE and WAIT are disabled, as is the Retries parameter. The retries is forced to 1 when RUN mode is being used. Newly received labels are handled as if the printer is in WAIT mode.
1public func cpclOneOutOfPaperMode(mode: String, retries: Int, state: String, filename: String, unused: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Mode | Space-Terminated String | A font name or number to create the representation | PURGE or WAIT |
Retries | 5 Digit Number | The number of attempts to make before aborting. | 0 to 65535 |
Parameter | Type | Description | Valid Range |
---|---|---|---|
State | Space-Terminated String | Specifies the state for line print purging. | ON or OFF |
Parameter | Type | Description | Valid Range |
---|---|---|---|
Filename | Space-Terminated String | The filename to run when an error occurs. | Any valid filename. |
Unused | 5 Digit Unit Number | An unused parameter that must be specified. | 0 to 65535 |
PACE
is used with label sessions with a print quantity greater than one to pause between each label. If such a label session is initiated, the printer will print one label, then stop, and wait for the feed key to be pressed before printing the next label. This behavior continues until all labels in the batch are printed. After the final label is printed, normal operation is resumed.- No other printing operations will occur while the printer is printing, including line print or prints from other languages.
- The command disables
AUTO-PACE
if it is in effect.The command is always persistent when used. If used in a label session, it takes effect on the label that will be printed when the session ends and any subsequent sessions.
1public func cpclPace()
- The
PAPER-JAM
command specifies how a paper-jam condition is detected, and what happens when it occurs.- The function can use either the media sensor and check to see if a mark or gap occurs to find if there has been a paper jam, or can use the peeler sensor to detect if no label is present after a label session is sent for printing.
- When using any mode besides
NONE
, if a paper jam is detected, an error will occur requiring the user to open the head, remove the jam, and then close the head before printing will continue.- The command can also return an optional message to the host when a jam occurs, see the
ALERT
parameter.- The command is persistent once set either in a label or in a utilities session.
1public func cpclPaperjamMode(mode: String, unused: String, message: String)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Mode | Space Terminated String | Sensor to use for detecting jam condition | See Below |
Unused | 5 Digit Number | Required unused parameter for some modes. | See Below |
Message | Quoted String | Message to be sent to host when using ALERT. | Up to 100 characters. |
- The
POSTFEED/PREFEED
command is used to perform an additional media movement before a label or line print section is printed.POSTFEED/PREFEED
can be used with both negative and positive numbers. Note that there is no mechanism that prevents you from feeding an excessively large negative value causing the printer to lose control of the media.- Using the
POSTFEED/PREFEED
command in a utilities session will cause it to be persistent until power off, and will also cause the setting to affect line print. If used in a label session, it will only apply to the label session in which it is used.- The
POSTFEED/PREFEED
operation will ignore all gap or marks on the paper but will terminate if the printer detects an out of media or other error condition.
1public func cpclPostFeed(amount: Int)
2public func cpclPreFeed(amount: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Amount | 5 Digit Unit Number | How much to feed in units. | -4000 to 4000 dots |
- When enabled, the
PRESENT-AT
command causes the printer to feed an additional amount once a label or line print section has been printed, and then when the next feed operation of any kind occurs, the motion is undone via an equal reverse feed. This allows the print to be pushed out to be at the correct tear off position, but still have the next print be registered to the start of the print operation.PRESENT-AT
can be used in either a utilities session or a label session. The effect is persistent until power cycle and in both cases takes effect as soon as the next print operation completes.- To disable
PRESENT-AT
, set Amount and Delay to 0. These are also the values used at power on.If PRESENT-AT was being used, and was then disabled, the printer will still properly reverse the last PRESENT-AT operation to ensure proper registration.Typically,- PRESENT-AT values are small, usually up to about 40. Using longer values may cause registration issues as the media drifts left to right as it is reversed.
1public func cpclPresentAtWithAmount(amount: Int, delay: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Amount | 5 Digit Unit Number | How much to feed in units. | 0 to 20000 dots |
Delay | 5 Digit Number | How long to delay before feeding in 1/8th of seconds | 0 to 240 |
- The
REVERSE
command, when used in a label session, is used to perform an additional media movement before a label is printed.- Its function is identical to that of
PREFEED
when used with a negative value, although reverse only supports positive values.- Note that there is no mechanism that prevents you from reversing an excessively large value causing the printer to lose control of the media.
- The
REVERSE
operation will ignore all gap or marks on the paper but will terminate if the printer detects an out of media or other error condition.- Once set, the setting is persistent until power cycle.
- The label session version of
REVERSE
also affects line print, but there is no way to change the setting except in a label session due to the different way REVERSE operates in utilities sessions.
1public func cpclReverse(amount: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Amount | 5 Digit Unit Number | How much to feed in units. | 0 to 4000 dots |
SETFF
is used to configure the length of a feed operation, and the advance amount after a mark or gap ends before the next label begins.- The values set with this command are persistent until power off regardless of whether set from a label or utilities session. They can be made permanent by using the zpl.save SGD. See the examples below.
1public func cpclSetFeed(length length: Int, skip: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
FeedLength | 5 Digit Unit Number | How long is a form feed operation in units? | 0 to 20000 dots |
FeedSkip | 5 Digit Unit Number | How long to move after a mark or gap ends? | 5 to 50 dots |
- The
SET-TO
F command is used to adjust where the sensing of a mark or gap occurs relative to the print line.- With the default value of 0, the printer positions the trailing edge of the mark or gap at the print line, so that when the next dot row is printed, it will be placed just after the mark or gap. All space up to this point is part of the previous label, and similarly, the same space at the end of the label is included in this label’s space.
- Adjusting this value to be a positive number moves the resting position of the end of the mark or gap to be closer to the source roll of media (inside the printer body). Adjusting the value to be a negative number moves the resting position of the end of the mark or gap to be further from the print line outside the printer. The feed skip value specified by
SETF
F is always applied after this positioning operation.If used in a utilities session, the setting takes effect on the FORM operation.- If used in a label session, the setting takes effect on that label session. In both cases, the setting is persistent until power cycle. The setting can be made permanent using the zpl.save SGD.
1public func cpclSetTOF(amount: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Amount | 5 Digit Unit Number | How much to feed in units. | -400 to 400 dots |
- The
SPEED
command is used to set the maximum speed at which printout occurs.When used in a label session, theSPEED
command takes effect on the label.- When used as a utilities command, it takes effect immediately for all subsequent printouts.
- The default speed is 3. Note that print speed in CPCL is not in units, but rather is a scale from 0 to 5. Higher values indicate faster printing, and lower values indicate slower printing. In addition, print speed is not absolute in CPCL. The printer may print slower than the value selected based on factors such as print head temperature or battery levels.
- This command sets the SGD media.speed, but does not set it to the number specified by Value, instead the number specified is converted to inches per second (which is what media.speed is represented in) and set. The actual value media.speed is set to varies from printer model to printer model based on the capabilities of the printer.
- Using the
SPEED
command causes the speed to be set permanently, persisting not only though label and utilities sessions, but through reboots as well.
1public func cpclSpeed(value: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Value | 1 Digit Number | Maximum speed to print in an arbitrary scale | 0 to 5 |
- The
TONE
command is used to set the darkness of the printout from the printer. It provides the same kind of adjustment ability as theCONTRAST
command, but with more fine control.- The range for
TONE
is -100 to 200, and the default is 0. Higher values are more dark and lower values are less dark. The TONE andCONTRAST
command both take precedence overSPEED
, and the printout will be slowed as necessary to reach the desired darkness value.- When the value is set in a label or utilities session, the value becomes permanent, similar to
SPEED
.- This command affects the print.tone SGD, but due to print.tone’s interaction with the print.tone_format SGD, the print.tone value may be in a different format than that of the
TONE
command. If the print.tone_format SGD is set to CPCL, the value of the print.tone SGD exactly mirrors that of the TONE command. If the print.tone_format SGD is set to ZPL, the value specified by the TONE command will be mapped to a 0.0 to 30.0 value system used by ZPL’s ~SD command. The converted darkness is identical to the original TONE value.- The
CONTRAST
command, which predated the TONE command, provides more rough control over the darkness level of the printout. When the TONE command is set to a non-zero value, theCONTRAST
command (and the print.contrast SGD) are ignored. When TONE is set to zero, ifCONTRAST
is non-zero, it will be used. Note that unlikeTONE
,CONTRAST
does not save its value permanently when set.
1public func cpclTone(value: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Value | 5 Digit Number | The relative darkness of the printout. | -100 to 200 |
TURN
changes the orientation of the printed label or of line print text, specifying either 0 degree rotation (top out first), or 180 degree rotation (bottom out first). When using this feature with line print mode, each line print buffer is individually rotated, which may cause some unexpected issues.- Once set via a label or utilities session, the command is persistent until power cycle. The value specified in a utilities or in a label session applies to both session types.
- Only the image portion of the label is rotated with this command; any media alignment commands function as expected.
1public func cpclTurn(degrees: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Degrees | 5 Digit Number | The orientation of the label. | 0 or 180 |
is used to simulate pressing of the form feed key on the printer when the printer is not in a session. This causes the printer to immediately attempt to synchronize to a mark or gap on the media, taking into account all adjustments (the TOF value from SET-TOF and label skip from SETFF). - The printer will search for the distance specified by the SETFF command (or by the media.feed_length SGD) for the mark before giving up. No error occurs if the printer cannot find the mark.
- The command is very similar to the utilities FORM command but has an important difference. The FF command will cause the printer to execute the feed action as defined with the ON-FEED command. If this command is set to IGNORE, FF will have no function. If set to REPRINT, FF will reprint the last printed label session. By default, the printer is set to ON-FEED FEED, so the command will cause a feed operation.
- Note that the FF.BAT file activated by physically pressing the feed key is not connected to the FF command, the bat file will not run when FF is received by the printer.
1public func cpclFormFeed()
NAME
returns the null-terminated name of the application currently running on the printer. In Link-OS printers, this is the same as the appl.name SGD.
1public func cpclName()
VERSION
returns a four-byte null-terminated representation of the version number of the version currently running on the printer. In Link-OS printers, this is the same as the appl.version SGD.
1public func cpclVersion()
h is an escape command which is used to determine printer status. - This command is an escape command, and is not valid within sessions. It can only be used when the printer is not currently in a session.
- The command returns a single byte, which is a bit field indicating various status attributes. To get the status of a particular field, mask off the unused bits.
1public func cpclPrinterStatus()
i is an escape command which is used to determine additional printer status. - This command is an escape command, and is not valid within sessions. It can only be used when the printer is not currently in a session.
- The command returns a single byte, which is a bit field indicating various status attributes. To get the status of a particular field, mask off the unused bits.
1public func cpclExtendedPrinterStatus()
v is an escape command which is used to obtain a string with printer information. - This command is an escape command, and is not valid within sessions. It can only be used when the printer is not currently in a session.
- The response of the command is a null terminated string of variable length which contains the product name, firmware version, compile date, CRC, and the device’s serial number.
1public func cpclGetVersionInfomation()
ABORT
terminates a label session in progress without performing any printing. Any label data received so far as part of this session is lost, except ifPERSIST
is enabled
1public func cpclAbort()
1cpclLabel(offset: 0, hRes: 200, vRes: 200, height: 210, quantity: 1)
2cpclPageWidth(240)
3cpclBox(xPos: 0, yPos: 0, xEnd: 200, yEnd: 200, thickness: 10)
4cpclBox(xPos: 50, yPos: 50, xEnd: 220, yEnd: 220, thickness: 10)
5cpclAbort() // 终止打印两个矩形
6cpclPrint()
BAUD
sets the current baud rate of the serial port. When executed, it permanently sets the comm.baud SGD. When the command is issued, it takes effect immediately and is persistent through reboots.- The command has no effect on printers which do not have serial ports. The default value of
BAUD
depends on the particular printer.
1public func cpclBaud(value: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Value | 5 Digit Number | The baud rate of the serial port. | See below. |
value
Specifies the baud rate to set the serial communications port to. Valid values are 115200, 57600, 38400, 19200, 4800, 2400, and 1200. Not all printers support all baud rates. If the baud rate isn’t supported on the current printer or is invalid, the BAUD command has no effect and the baud rate remains unchanged.
BEEP
causes the printer to produce an audible beep. The length of the beep is specified in 1/8th of a second increments. While the beep is active other tasks such as printing may be paused.
1public func cpclBeep(duration: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Duration | 5 Digit Number | The length of the beep in 1/8ths of a second | 0 to 65535 |
CAPTURE
provides a tool that can be used to capture data that the printer receives to a file on the printer, and can also optionally be used to put the printer into a dump mode which prints the characters received rather than interpreting them.- The
CAPTURE
command directly sets the input.capture SGD until reboot.
1public func cpclCapture(mode: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Mode | CR-LF Terminated String | The capture mode to enable | PRINT, RUN, OFF |
CHECKSUM
returns a four-byte, null-terminated, pre-calculated checksum of the firmware image on the printer.- In earlier printers, this command calculated the checksum of the firmware and returned it. Because it takes an extended amount of time to calculate the checksum, this command returns a fixed checksum for compatibility, and the new
CHECKSUM
command is used to verify the checksum.CHECKSUM
is used to validate that the checksum returned by the CHECKSUM command matches the actual checksum of the firmware.- The
CHECKSUM
function returns a pre-calculated checksum in order to provide a quick response to the command for backward compatibility. To validate that the firmware actually matches that checksum theCHECKSUM
command is used.- The
CHECKSUM
command can take many seconds to execute as it calculates the checksum. Once complete, it will return either two or three characters, either the word yes or no with no termination. During the time of calculation, the printer is unavailable to receive other commands.- If the command returns yes, the checksum provided by
CHECKSUM
has been validated. If the command returns no, the checksum calculated did not match that provided by CHECKSUM.
1public func cpclCheckSum()
2public func cpclCheckSumVertical()
CHAR-COUNT
returns a null terminated string indicating the number of characters received since the last time the CHAR-COUNT command was issued. The value is always set to 0 at startup. When the value is read out, it is reset to 0.- The size of the
CHAR-COUNT
command is always included in the number of characters counted, because the value is returned after the command is parsed.CHAR-COUNT
counts the received characters for all data received by the printer’s parsers on all interfaces, not just data which is received by the CPCL parser.
1public func cpclCharCount()
DELAYED-ACTIONS is used to execute a file that is stored on the printer after a delay.
1public func cpclDelayedActionsWithFileName(filename: String, delay: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
FileName | Space-Terminated String | Filename to execute after delay | A valid filename |
Delay | 5-Digit Number | Time to delay in 8th of a second increments | 0 to 65535 |
DISPLAY
is used to display raw text on the display of the printer. The command is parsed but has no effect on printers which do not have displays.- The command has two options. TEXT (and its alias T) are used to place text on the display, and the LCD- DBG INFO option is used to obtain information about the display.
1public func cpclDisplay(message: String)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Message | Text to place on the screen. | Any Text. |
DUMP
is an alias for CAPTURE PRINT in Link-OS printers. See that command on page 258 for more information.
1public func cpclDump()
- DUMP-IMAGE dumps the label memory of a label session currently being rendered.
- The command can either dump label memory in bytes or in bits. If the BYTES option is specified, the label data is returned in hexadecimal bytes, otherwise it is returned in binary.
- This command can only be used in label sessions, and the label data is dumped at the time the command is parsed. Note that the dumping can take a rather long time, and during that time no other system operations can occur.
1public func cpclDumpImageWithBitsWithLineCount(lineCount: Int, start: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
LineCount | 5-Digit Number | The number of dot lines to dump | 0 to 65535 |
Start | 5-Digit Number | The starting dot line to dump | 0 to 65535 |
GET-DATE
returns the current date as set on the printer’s real-time clock to the host. While all printers have a real-time clock, not all of them are battery backed up to preserve the time when the printer is powered off. See your printer’s documentation for more information.- The date is formatted in the form
mm-dd-yyyy
, followed by a NUL character.- The date can be set either via the rtc.date SGD or the
SET-DATE
CPCL command.
1public func cpclGetDate()
GET-TIME
returns the current time as set on the printer’s real-time clock to the host. While all printers have a real-time clock, not all of them are battery backed up to preserve the time when the printer is powered off. See your printer’s documentation for more information.- The time is formatted in the form
hh:mm:ss
, followed by a NUL character. The time is always in 24-hour format.- The time can be set either via the rtc.time SGD or the
SET-TIME
CPCL command.
1public func cpclGetTime()
GETVAR
is the primary method of retrieving the current setting of a configuration setting from the printer. These configuration settings are called SGD settings, short for Set-Get-Do, which outlines the three commands that can be used to interact with the settings,SETVAR
,GETVAR
andDO
.- These three commands are always available on every Link-OS printer, regardless of current language selected. Even Link-OS Printers which do not support the CPCL language support these CPCL commands.
- The
GETVAR
command can be in lower or upper case, but must be of a single case (it cannot be mixed). Generally CPCL commands must be in upper case, but this one is supported in both cases for backwards compatibility.- When used to access settings, the
GETVAR
command returns the current value of the setting. Some settings are preserved between power cycles, and some settings can also have temporary values that will be reset to the saved value with the printer is reset.- The
GETVAR
command cannot be used to determine properties about the setting, only its current operating value. See the documentation of each SGD for more information.- The response to
GETVAR
is a quote-bound string specifying the value of the setting requested. If the setting is not available or not valid on this printer, the response will be a double-quote bound question mark.- Requesting some settings which are not supported my result in an empty pair of double-quotes.
- SGD settings are organized into branches, which group settings of similar type. The available setting branches vary depending on the model of printer.
1public func cpclGetVarWithSettingName(settingName: String)
LT
is used to change the way CPCL lines are terminated. At power on, all lines in CPCL must be terminated with. All examples and text within this document refer to this default behavior. It is possible, however, to change the way lines are terminated using this command. - Regardless of what mode is selected, lines can always be LF terminated, and any CR that exists before the
LF
will be consumed. Lines can also always be NUL terminated.- When an invalid command is received by CPCL, the parser always consumes the data up to the next
CR- LF
, regardless of the setting ofLT
.- The various parameter types in CPCL act differently with regard to how they handle excess characters besides the specific ones specified, or other details on how they are terminated.
- For example, while a numeric parameter will consume any excess CRs before an LF, a file parameter such as in
GETVAR
will not. It is also possible to terminate commands with spaces, and in some cases arbitrary characters. The rules vary based on the parameter type that is the last one in the command, or in some cases, the command itself.- For this reason, it is best to select the proper terminator and use it as specified to ensure correct behavior.
1public func cpclLineTerminator(mode: String)
Mode | Description |
---|---|
LF | Lines are terminated with LF. A single CR before the LF is always ignored. |
CR-LF | Same as LF. |
CR | Lines are terminated with CR or LF. An LF character after a CR will not be processed and will fall out to the next parser. |
CR-X-LF | Lines are terminated with |
MAX-LABEL-HEIGHT
is a command provided for backwards compatibility. In previous CPCL products, it returned the maximum number of dot lines a label session could be due to memory limitations.
- In Link-OS, this value is always 65535, which is the maximum label height supported in CPCL. The value is null terminated.
1public func cpclMaxLabelHeight()
- ON-FEED specifies what occurs when the user presses the feed button.
- By default, and each time the printer is powered on, the feed button on the printer causes the printer to feed to the next mark or gap, or in the case of continuous media the page length set by SETFF. See page 232 for more information on that command. This command allows to you change the function of the feed button to either have it reprint the last label, or ignore the key press.
1public func cpclOnFeed_Feed()
2public func cpclOnFeed_Reprint()
3public func cpclOnFeed_Ignore()
Value | Description |
---|---|
FEED | Paper is fed to mark or gap as described above. This is the default behavior. |
REPRINT | The last label printed is printed again. If no label has been printed since power on, no motion occurs. |
IGNORE | The key press is ignored, and no motion occurs. |
ON-LOW-BATTERY
specifies an optional alarm and message which is presented to the user when the battery of the printer is low.- The three options in the command,
ALERT
,ALARM
andNONE
are all optional, any number or none of them may be present, though if none are, the command is parsed but has no effect.- By default, both the audio and text alert are disabled (which is equivalent to the NONE option).
- The notifications only take effect on the point of transition to battery low. If the battery is already low when the commands are sent, they will not have any effect until the battery transitions from normal to low again.
1public func cpclOnLowBatteryWithAlertText(altertText: String, alarmLength: Int)
2public func cpclOnLowBateryWithNone()
Parameter | Type | Description | Valid Range |
---|---|---|---|
AlertText | Quoted String Parameter | Specifies the text to be displayed when the battery is low on the display | 0 to 100 characters |
AlarmLength | 5-Digit Numeric Parameter | Specifies length of audible alarm in 1/8th of a second increments | 0 to 65535 |
RE-RUN
is a special purpose command that can only be used within formats which are stored on the printer. The command instructs the printer to run the format file again once it has completed execution.
1public func cpclReRun()
SET-DATE
sets the current date on the printer’s real-time clock. While all printers have a real-time clock, not all of them are battery backed up to preserve the time when the printer is powered off. See your printer’s documentation for more information.- The date is formatted in the form
mm-dd-yyyy
.- The date can be read via the rtc.date SGD, or via the
GET-DATE
CPCL command.
1public func cpclSetDate(date: String)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Date | CR-LF Terminated String | The date to set the real-time clock to. | See below. |
SET-TIME
sets the current time on the printer’s real-time clock. While all printers have a real-time clock, not all of them are battery backed up to preserve the time when the printer is powered off. See your printer’s documentation for more information.The time is formatted in the form
hh:mm:ss
.The time can be read via the rtc.time SGD, or via the
GET-TIME
CPCL command.
1public func cpclSetTime(time: String)
SET-VERSION
is used to set the response of theVERSION
command (as well as the appl.version SGD). This function is provided so that applications that rely on a particular reply for the VERSION command can continue to function with newer versions of software.
- The change of value is temporary, and cannot be stored permanently. Upon reboot, it will always reset to its default value which
1public func cpclSetVersion(version: String)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Version | The version to set appl.version to | Up to 20 characters |
SETVAR
is the primary method of setting the value of a printer configuration setting. These configuration settings are called SGD settings, short for Set-Get-Do, which outlines the three commands that can be used to interact with the settings,SETVAR
,GETVAR
andDO
.- These three commands (SETVAR, GETVAR and DO) are always available on every Link-OS printer, regardless of current language selected. Even Link-OS Printers which do not support the CPCL language support these CPCL commands.
- The
SETVAR
command, and its aliasDO
, can be in lower or upper case, but must be of a single case (it cannot be mixed). Generally CPCL commands must be in upper case, but this one is supported in both cases for backwards compatibility.- Some settings are not actually settings, but triggers for actions. These are commonly called “DO” commands. The device.reset SGD is one such example of a DO. Setting the device.reset SGD to any value, including an empty string, causes the printer to reboot. It is the setting which determines if an action is taken or if a setting is changed. Either setting command may be used to activate the function.
- When
SETVAR
is used to set a setting which is persistent between power cycles, SETVAR will set the setting in such a way that it is saved. This statement may seem obvious, but some commands which set settings set them in such a way that they will be restored to the last saved value on power cycle.- Not all settings persist between power cycles; see the documentation of each SGD for more information.
1public func cpclSetVarAndDoWithSettingName(settingName: String, value: String)
SettingName
Specifies the name of a setting to which is to be set. This string should be bound by double quotation marks.
Value
Specifies the value to set the setting to. This string should be bound by double quotation marks.
TIMEOUT
is used to set the amount of time the printer will sit idle before it powers down. This function generally only applies to printers powered by batteries.- Idle is considered by the printer to be a state without printouts, user interaction with the keypad, or changes in printer status (such as head open to close).
- Setting the
TIMEOUT
to zero disables the power down on idle functionality.- This function explicitly sets power.inactivity_timeout, but the value set by TIMEOUT only persists until reboot (or power down). Setting the SGD explicitly will make the setting permanent. See the SGD documentation for more information on the function.
1public func cpclTimeout(value: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Value | 5 Digit Number | The length of the timeout in 1/8ths of a second | 0 to 65535. |
WAIT
is used to add a delay in a label session after a label is printed.- Only one
WAIT
command can be used per label session. The final WAIT command in the label is the one which is executed. If the label is reprinted, or if it is part of a batch, the wait will occur each time it is printed.
1public func cpclWait(duration: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Duration | 5-Digit Number | Length to delay in 1/8ths of a second | 0 to 65535 |
- X, Y, and XY are used to specify the value of X and Y parameters in label sessions, eliminating the need to specify them in label formatting commands.
- The X, Y and XY commands have a different effect if used in Line Print mode. See those commands on page 181 for more information.
- These commands affect many functions in CPCL. Anywhere the parameter names [X] or [Y] are used in this document, this function will replace them if the commands are used in label sessions.
- X permits you to set and omit the X parameter, Y permits you to set and omit the Y parameter, and XY does both. Each can be individually activated and deactivated.
- When the label session ends, the X, Y and XY commands are deactivated.
1public func cpclSetLabelPosition(xPos xPos: Int, yPos: Int)
2public func cpclSetLabelPosition(xPos xPos: Int)
3public func cpclSetLabelPosition(yPos yPos: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
XValue | 5 Digit Number | Specifies the value to use for the X position | -1 to 65535 |
YValue | 5 Digit Number | Specifies the value to use for the Y position | -1 to 65535 |
is an escape command which sounds the printer’s bell. It has no parameters. The character is ASCII character 7.
1public func cpclSoundPrinterBell()
is an escape character which is used to back up the text cursor one position along the X axis. The amount backed up is determined by the last character printed. If no character has been printed, no motion occurs. - This command applies to line print mode, as well as any label command in the family of TEXT commands .
- The BS command us not supported when using TrueType fonts with ROTATE values besides 0.
1public func cpclBackspace()
The CCL Key is the character used to start sessions. By default, and at power on, the Key is set to the exclamation point character .
1public func cpclGetOrSetCCLKey(key: Int)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Key | Single Raw Byte | Specifies the CCL Key. | 0 to 255 |
I is used to instruct the printer to transmit the two-key report to the host, rather than printing it. The V command is used to print the two-key report. - The two key report returned via this command has the same fields and information as the printed report, although it omits any barcodes that may be printed on the report.
1public func cpclSendTwoKeyReportToHost()
JRU is used to retrieve the user label count, which is incremented any time a label is printed, regardless of control language the label originated from. - The value is returned as a 16-bit number (2 bytes), which represent the same value as contained in the SGD odometer.user_label_count.
1public func cpclSendUserLabelCount()
N is used to acknowledge the fact that the printer has been reset. The reset status is part of the h command, representing bit 4. At power on, that bit initially is a value of 1. After issuing the N command, the value of that bit changes to 0 and remains so until the printer is reset.
1public func cpclAcknowledgeReset()
p is used to shut down the printer. This feature only applies to printers which can shut themselves down, which includes all battery-based Link-OS printers. - As soon as the command is received, the printer will power off.
- This function is equivalent to setting the power.shutdown SGD to anything.
1public func cpclShutDownPrinter()
V is used to instruct the printer print a copy of the two-key report the two-key report.
1public func cpclPrintTwoKeyReport()
- The MCR command is used to configure all aspects of the magnetic card reading system in CPCL.
- The Timeout parameter and at least one track must be specified, but all other parameters are optional.
- The MCR command is very versatile and can be used in a number of ways. Be sure to see the examples section for some examples of the various ways the command can be used.
- At the start of each MCR command, all options in the MCR system are reset to the values listed as defaults below, for both options and parameters.
- On printers without magnetic card readers, this command is parsed but ignored.
1public func cpclMCRWithTimeout(timeout: Int,delimiter: String, errorPrefix: String, prefix: String, postfix: String)
Parameter | Type | Description | Valid Range |
---|---|---|---|
Timeout | 5 Digit Number | The timeout of the MCR command | 0 to 65535 |
Delimiter | Space Terminated String | The delimiter for the track number designators | Any 2 characters |
ErrorPrefix | Space Terminated String | Text placed before an error message | Up to 12 characters |
Prefix | Space Terminated String | Unit-width of the barcode in dots | Up to 12 characters |
PostFix | Space Terminated String | Configuration options for barcode | Up to 12 characters |
- MCR-CAN is used to abort an active MCR command. The command can be used to abort sessions with the MUTLIPLE option in the MCR command, and also will abort an MCR session with a timeout which has not yet expired.
- Any reads attempted once MCR-CAN has been issued will be ignored. If a read has occurred which has not yet been retrieved via the MCR-QUERY command, that data will still be available via the MCR-QUERY command and is not cleared.
- If no MCR session is active, the MCR-CAN command has no effect.
- See the MCR command in the previous session for more information on the MCR-CAN command.
1public func cpclMCRCan()
MCR-QUERY
is used to obtain the result of a magnetic card reader swipe when the MCR configuration command contains the QUERY option.- By default, the MCR command will return scanned card data directly to the host as soon as the card is scanned. If this behavior is not desirable, the QUERY option can be added to the MCR command to indicate that the
MCR-QUERY
command is used to obtain the data on the card once it is scanned, rather than sending it as soon as it is available.- The
MCR-QUERY
command will only return card data one time. As soon as it returns the card data, the card data is cleared from the printer’s memory, so issuing the command more than one time per card read will not work.- If you issue the
MCR-QUERY
command and there is no read data present, no data will be returned by the printer.- In the case that the MULTIPLE option was specified in the MCR command along with QUERY, it is possible that if the user scans multiple cards in the interval between reads, reads can be lost.
MCR- QUERY
will only return the data for the most recent scan in this case.
1public func cpclMCRQuery()
DEFINE-FORMAT
, or it alias DF is used to create formats for use withUSE-FORMAT
, or it’s alias UF, or for general use within the printer. The format of the sessions is as follows.
1public func cpclDefineFormat(filename: String)
2public func cpclUseFormat(filename: String)
Field Name | Description | Type | Valid Range |
---|---|---|---|
Filename | The name of a filename to create on the file system. | 38 alpha-numeric characters plus drive letter and period for extension |
DELETE
is used to remove a file from disk. The file to be deleted can either be on the E drive or the R drive. All files on these drives can be deleted.
1public func cpclFileDelete(filename: String)
Parameter | Type | Description | Valid Range |
---|---|---|---|
FileName | CR-LF Terminated String | The name of the file to delete | See below |
DIR
is used to retrieve a listing of the files on the E drive and R drive of the printer. The files are returned in a list format with the file name on the left side and the file size on the right side. Files on the R drive are represented by the presence of (r) after their file name. The files are displayed in the order they were loaded on to their respective drive. The R drive files always appear last on the list.
1public func cpclFileDir()
- The
END
command, when used in aDEFINE-FILE
orDF
session instructs the printer to terminate the session and close the file being defined.- This command is an alternative to the PRINT command, which closes file after writing the PRINT command to the file.
- This command is quite commonly used when defining batch files for the printer, as they typically contain only configuration commands, and not any material to be printed.
1public func cpclFileEnd()
- The
FILE
command has two functions. The first is the ability to rename existing files, similar to the file.rename SGD. The second function is the ability to calculate a CRC16 on an existing file on the printer.- Either or both of the options may be specified in any order, though the new file name must follow the RENAME command.
1public func cpclRenameFile(oldFilename oldFilename: String, newFilename: String)
Parameter | Description | Valid Range |
---|---|---|
FileName | The name of the file to operate on | up to 38 characters with a 5 character extension after the dot |
NewFileName | The new name of the file if using the RENAME option | up to 38 characters with a 5 character extension after the dot |
- The type command is used instruct the printer to transmit the contents of a file to the host. The file will be transmitted on the same port on which the command was received.
- Not all files can be typed. The same rules apply to this command as do to the file.type SGD. The following file extensions cannot be typed. An attempt to type a file with any of these extensions will result in no data being returned.
1public func cpclFileType(filename: String)
Parameter | Description | Valid Range |
---|---|---|
filename | The name of the file to operate on | up to 38 characters with a 5 character extension after the dot |