Warm tip: This article is reproduced from stackoverflow.com, please click
zpl zpl-ii

ZPL code sent to printer prints 2 blank labels before printing the actual label

发布于 2020-03-29 21:01:00

The following ZPL code when sent to a Zebra GX-420D printer with 2"x2" labeld loaded, does 2 very strange things:

  • Skips the first 2 labels and only prints on the 3rd one
  • Repeat this (2 blank labels + one with content) one more time, after a short delay.

So in total it uses 6 labels, and the content is only on the 3rd and 6th one.

Here's the code:

^XA
^FX Test for long barcode
^BY1,2,50
^FO20,10^BC^FD>6UIQ-2013P-MR-BU^FS
^XZ

Is there anything in the above code that would cause this phenomenon?

Questioner
BenVida
Viewed
36
BenVida 2020-02-03 14:48

I eventually figured it out. I was trying to remotely fix this, not having a direct access to the printer and not seeing what it printed and how. But eventually I got access to a printer and then it didn't take long to fix.

It seems that there were some defaults or setting left over from the previous print jobs that cause the problem. I added some resetting of values in front of the printing and after that it properly printed out just one label.

And yes, the ^FS was not needed at the end of the comment with ^FX.

Here is the code that printed out the same thing correctly (there might be some unnecessary commands but this one worked so I left it at that):

^XA~TA000~JSN^MNW^PON^PMN^LH0,000~SD15^XZ

^XA^JUS^XZ

^XA

^MMT
^PW0355
^LL0305

^FX Test for long barcode
^BY1,2,50
^FO20,10^BC^FD>6UIQ-2013P-MR-BU^FS
^XZ