Label Alignment Issue



  • Official comment
    Aaron - Flex Staff

    Hey Scott- no second post necessary, as both points tie to the same explanation. Of all the default labels, the 2x0.5 Data Matrix is the only one that has this by default, but it essentially boils down to the code of the template. 

    In the essentials edition of ZebraDesigner, you can set the anchor point location of an element like a text field, which helps for alignment and sizing, but it does not carry through to the .PRN file you generate to get your template text- you may notice this in labelary as well if you replace your tokens with data that may take that place when the label is printed from Flex. 

    But, essentially, to center text in a field and have that text wrap over to additional lines, the code is the same with the ^FB or Field Block command, which turns a ^FT or Field Text command/area to a proper text box with formatting options and line wrapping.

    So, for default labels, the portion of the template code that represents the item name usually looks like this:

    ^FT is the command, 12,46 is the x,y position in dots. ^A0N,20,21 is the Font, and font size. ^FD proceeds the content of the field, and ^FS ends it.

    In the Data Matrix template, the same command looks like this:

    So after we define the font with ^A0N, we further define the ^FT field as a Field Block with the ^FB command. To briefly explain ^FB, it works like this: ^FBa,b,c,d,e

    represents the total width of the block in dots
    represents the height of the block in lines
    represents the spacing between lines- zero is the default, not an actual value of zero/no spacing
    represents the alignment, of Left, Center, Right, or Justified, with the respective values of L/C/R/J

    So, ^FB304,2,0,C establishes a field block 304 dots wide, text wrap to two lines, default line spacing, and center alignment.

    That should cover your inquiries as far as Centering names and other text, and wrapping text to additional lines. 

    Regarding Barcodes- this is a bit more difficult than text- for Code128, I was able to find a stackoverflow thread on the same topic, but it seems fairly involved- I would typically put dummy information in that field in labelary, and play with the x,y until it was aligned well.

    I'll add that as far as I know, the paid version(s) of ZebraDesigner supposedly have more features which can help for projects like this, however for our purposes it's tough to justify the software expense for designing a  couple labels, and so that's why I typically suggest doing more advanced things like this in the code, despite the difficulty.

    Let us know how it goes!

    Comment actions Permalink
  • Scott Melnyk

    Aaron! Thanks for taking the time to go into the detail and spelling it out so clearly!! The ^FB explanation was such a fast fix for us. Turns out we had it in the code already, just the height of the block (b) was set to 0. Did a quick little adjustment of the ^FT to keep it looking right and then it was good to go!

    Honestly, regarding the barcode alignment,  we just manually moved it in ZD3 so that it spits out something that looks right in the real world. The barcode field is up in the top right corner of the software, but looking pretty centred on our physical labels. Unless there's a future issue that might would arise from that, we're happy to go with it as is.

    Great support - We really appreciate it!


    Comment actions Permalink

Please sign in to leave a comment.