Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Comment line in ZPL code

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?

like image 816
Luciano Marqueto Avatar asked Oct 16 '14 14:10

Luciano Marqueto


People also ask

What are ZPL commands?

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.

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


1 Answers

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.

like image 191
Magoo Avatar answered Sep 23 '22 09:09

Magoo