Introduction to Portable Mobile Printing Protocol CPCL

Currently, various industries are extensively using portable mobile printing devices. For example, couriers print shipping labels on-site when collecting packages, traffic police issue on-the-spot penalty tickets, and parking fees are collected, all of which may involve the use of portable mobile printing devices. These devices come with Bluetooth or USB interfaces, have built-in rechargeable batteries, and can be controlled via mobile phones, PDAs, etc., making them very convenient to use.

Common portable mobile printing devices, such as those from Zebra, Hanin, and New Beiyang, generally adopt the CPCL protocol. The printing commands and the printing devices usually communicate through Bluetooth or USB interfaces.

I. How to Use CPCL Printers

CPCL is a simple, efficient, text-based printing command set. To use a CPCL protocol printer, one must have a basic understanding of CPCL printing commands.

Printing Commands

Printing must start with the "!" character, followed by the "x" offset parameter, "x" and "y" axis resolutions, label length, and the number of labels to print. This is known as the command start line.

Printing ends with the "PRINT" command. Between the start line and the ending PRINT command, various commands can be used to achieve specific functions, such as printing text, barcodes, QR codes, images, etc.

Each field in the command line should be separated by a space character.

Example:

!0 200 200 210 1
TEXT 4 0 30 40 Hello World
FORM
PRINT

The first line of this command is the start line, setting the x-direction offset of the print label to 0, the x and y direction printing resolutions to 200 DPI, the label height to 210 dots, and the number of prints to 1.

The second line is the text output command, indicating the use of font size 4 to print "Hello World" at coordinates (30,40).

The third line, FORM, means that after printing is completed, it automatically moves to the next page.

The fourth line executes the print.

The CPCL print command set also includes commands for barcodes, QR codes, image printing, etc. By combining these commands, various complex labels can be printed. For a complete CPCL print command reference, please refer here.

Outputting Print Commands

By transmitting the above commands to the printer via a Bluetooth or USB interface, printing can be completed. Generally, printer manufacturers provide SDKs that offer basic APIs for connecting to printers and transmitting print commands.

II. PrintSpirit's Support for CPCL Printers

From the above introduction, it can be seen that the basic concepts of CPCL print commands are relatively simple. However, designing an actual label using CPCL commands can be cumbersome: you need to be familiar with various CPCL commands, write programs to connect to the printer, and most troublesome, it's hard to imagine the final print effect without printing it out. Debugging a label, especially a complex one, can take a lot of time. Is there a quicker solution?

Yes, that's the label design feature provided by PrintSpirit.

The PrintSpirit label design module uses a graphical interface, requiring no knowledge of any print commands. Through intuitive drag-and-drop, you can add various elements such as text, QR codes, barcodes, graphics, etc., to complete label design. Labels designed by PrintSpirit can be used as templates: the overall structure of the label remains unchanged, while some print areas can be replaced with variables to print labels with different content.

The internal format of the label is printer-independent, supporting printing on WEB, mobile devices, and embedded devices simultaneously. It can support CPCL printers, ZPL printers, and Windows printers. With the corresponding print controls, it can achieve basically the same print effects on the above devices.

For mobile devices, PrintSpirit offers two solutions: one is the SpiritMobile Android SDK, a native SDK with strong performance and great flexibility, suitable for teams with Android developers; the other is SpiritMobile H5, suitable for teams using JS for mobile development, characterized by simplicity, no need to understand the underlying Android content, and completely using JS to complete print program design.


Leave Your Message

login