I want to comment lines in the ZPL code, for example:
^XA
^MMT
^LL0531
^PW1280
^LS0
^FT81,528^A0B,29,28^FH\^FDTEXT^FS
// ^FT336,495^A0B,29,33^FH\^FDEAN^FS^FX ----
//^BY3,2,42^FT384,492^BEB,,Y,N Commented lines
//^FD789690466123^FS ----
^PQ1,0,1,Y^XZ
I want this because sometimes my variable is null and do not want to print the barcode. This is possible? or what the best way to not print the barcode?
Resolution / Answer. 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).
The short answer is "Can't be done."
The comment-indicator is ^FX
after which characters are ignored - but end-of-comment is any ^ or ~ command
which makes ^FX
next to useless.
Unless there has been a "block-comment" command added, with a specific start/end-block-comment mnemonic-set, then sorry - you're out-of-luck.
All is not quite lost however.
^XA
^FT336,495^A0B,29,33^FH\^FDEAN^FS^FX
^BY3,2,42^FT384,492^BEB,,Y,N
^FD789690466123^FS
^MMT
^LL0531
^PW1280
^LS0
^FT81,528^A0B,29,28^FH\^FDTEXT^FS
^PQ1,0,1,Y^XZ
will recognise the lines-to-be-commented-out.
^FT336,495^A0B,29,33^FH\^FDEAN^FS^FX
^BY3,2,42^FT384,492^BEB,,Y,N
^FD789690466123^FS
^XA
^MMT
^LL0531
^PW1280
^LS0
^FT81,528^A0B,29,28^FH\^FDTEXT^FS
^PQ1,0,1,Y^XZ
would ignore them, as data between ^XZ
and ^XA
is disregarded.
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