ZPL FB FIELD BLOCK COMMAND DOES NOT PROPERLY CENTER THE TEXT

Article ID: 46411518

DETAILS

Topic or Information

The Field Block ^FB command does not center the text as expected.

Why can't I put the text in the middle? 

Applies To

ZPL compatible printers

Details

A customer reported a problem centering the text using the ^FB command. The command details looked to be correct but the field was slightly offset. (Note:This example was using a 2" wide 203 dpi printer)

^XA^MMT^LT0^PW408^LH0,0^LS0 
^FO010,010^GB200,100,1,B^FS
^FO010,010^GB100,100,1,B^FS
^FO010,020^A0N,100,100^FB200,3,0,C,0^FD$5^FS
^XZ

User-added image

 

If you look at the ^FB Command Details in the Read More>> link below, you will see that there are a few meta-commands that can be used in the data string for formatting the text. Specifically, \& adds a carriage return/line feed so you can have multiple lines of text in the block. (Note that you have to set the b parameter to something greater than 1 if you want more than one line of text)

It turns out, if you add \& to the end of a text line in the ^FB text and you are using the C option for justification, it properly centers the line, even if you only have one line of text.

Note: Use of the ^FH\ will interfere with this suggested work around so don't include that when creating any ZPL.

Here is the ZPL format that will help center the text......

^XA^MMT^LT0^PW408^LH0,0^LS0
^FO010,010^GB200,100,1,B^FS
^FO010,010^GB100,100,1,B^FS
^FO010,020^A0N,100,100^FB200,3,0,C,0^FD$5\&^FS
^XZ

User-added image

Additional Information

^FB Command Details Read More>>

Source

David F