I am maintaining a program that outputs ZPL to a label printer. Today, the character sequence ~Ja came in as part of a string to be printed, which is ZPL's "cancel all" command. Needless to say, the label did not print.
Is there an easy way in ZPL to escape a tilde?
After downloading, open Zdesigner software and click on the Open Communication with Printer button. Click the Open File icon and select a ZPL label file from your computer. Click the Send to Printer button.
Zebra Programming Language (ZPL) is the command language used by all ZPL compatible printers. It is a command based language used by the printers as instructions to create the images printed on the labels.
There is not a separate command to draw a simple horizontal or vertical line, but the ^GB command can be used for this purpose by drawing a rectangle with height = 1 (horizontal line) or width = 1 (vertical line).
Use the ^FX command, format like below, to enter non-printable comments. NOTE The ^FX command needs to be in between the ^XA and ^XZ commands, and the comment needs to be ended with the ^FS command.
You can use ~CT
or ^CT
to change the tilde control character to any other ASCII character, and then you can print tildes normally. However, the new control character won't be printable. This is probably going to be quite a hassle to maintain.
An example changing the control command prefix to +
, taken from page 165 of the ZPL II programming guide:
^XA
^CT+
^XZ
+HS
If your string is represented as field data with ^FD
, ^FV
, or ^SN
, you can use ^FH
to encode the tilde in the string with its hex value, 7E.
An example, taken from page 192 of the ZPL II programming guide:
^XA
^FO100,100
^AD^FH
^FDTilde _7e used for HEX^FS
^XZ
Output:
Tilde ~ used for HEX
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With