Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to print a tilde (~) in Zebra Programming Language (ZPL)

Tags:

zpl

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?

like image 642
user1171848 Avatar asked May 29 '13 18:05

user1171848


People also ask

How do I print a ZPL label?

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.

What are ZPL commands?

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.

How do you draw a vertical line in ZPL?

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).

How do you add comments in ZPL?

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.


1 Answers

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

like image 111
Esoteric Screen Name Avatar answered Sep 20 '22 15:09

Esoteric Screen Name