Search code examples
labelzebra-printerszplzpl-ii

Horizontal text for Zebra ZPL script


I'm creating "labels" for our Zebra ZT410 300Dpi printer. Those are simple ones that contains just Name (variable size max 15 chars) and QR code (Usually same). So far, I've done this:

^XA^LH0,0^FWb
^MUd,150,300
^A0,65,75^FO100,150^FD
Test
^FS
^FO275,400^BQN,2,10,H^FDMM,A
Test
^FS^XZ

look at picture 1. Text tends to align to right side.

So I tried to modify it like this

^XA^LH0,0^FWb
^MUd,150,300
^A0,65,75^FO100,150^FB0,350,15,C^FD
Test
^FS
^FO275,400^BQN,2,10,H^FDMM,A
Test
^FS^XZ

But instead of centering against label Height, it centers against width and text is now vertical. Look at picture 2.

Picture 1 Picture 2


Solution

  • You can use the ^FB command to center text => https://i.sstatic.net/LG3YH.jpg

    ^XA
    ^LH0,0^FWb
    ^MUd,150,300
    ^A0,65,75^FO100,0^FB1800,1,0,C,0^FDTest^FS
    ^A0,65,75^FO200,0^FB1800,1,0,C,0^FDThis is a center text^FS
    ^FO275,400^BQN,2,10,H^FDMM,ATest^FS
    ^XZ