Search code examples
zebra-printerszpl

Zebra ZPL cut off trailing instead of wrapping


I am correcting a ZPL string which is overlapping text. Here is that string.

^XA\r\n
^CF0,31,24\r\n
^FO25,20^FDMFD BY:^FS\r\n
^FO25,20^FB412,2,5,L,0^FDMFD BY: THE LONGNAME MANUFACTURING COMPANY     
LONGNAME, IL^FS\r\n
^XZ

Pluggin that into http://labelary.com/viewer.html you will see that on the second line of text, the words overlap each other. This can be fixed by allowing the text to wrap onto a third line, but I am limited to only 2 lines of text.

Instead of trying to wrap over the second line, how I can cut off the excess letters?

In other words, I want it to render as if the text looked like this.

^XA\r\n
^CF0,31,24\r\n
^FO25,20^FDMFD BY:^FS\r\n
^FO25,20^FB412,2,5,L,0^FDMFD BY: THE LONGNAME MANUFACTURING COMPANY     LONGNA^FS\r\n
^XZ

This way it does not try to wrap the third line, but limits it to only 2 lines.


Solution

  • Use ^TB instead. It has the cropping you are looking for:

    ^XA
    ^CF0,31,24
    ^FO25,20^FDMFD BY:^FS
    ^FO25,20^TBN,412,62^FDMFD BY: THE LONGNAME MANUFACTURING COMPANY LONGNAME, IL^FS
    ^XZ