ZPL - how to right justify a bar code?

Jesse Rallo picture Jesse Rallo · Sep 13, 2013 · Viewed 10.1k times · Source

I am trying to right justify a bar code I am printing using ZPL from a .Net program. Here is my current code:

^FO10,50^FB500,1,0,R,0^AO,40,40^BY3^BCN,100,Y,N,N^FD1234567^FS^XZ

The Field Block seems to be ignored when working with a bar code, but for text it justifies it correctly. Any ideas?

Answer

user3384842 picture user3384842 · Nov 16, 2014

Newer Zebra firmware supports a third parameter on ^FO and ^FT. If you want to right justify something, specify the right edge as the x parameter, and include a 1 as the third parameter.

^XA
^BY3
^FO85,30^GB500,450,3^FS
^FO100,50^BCN,30,Y,N,N
^FD>;12345678^FS
^FO100,120N^BCN,30,Y,N,N
^FD>;123456^FS
^FO100,190^BCN,30,Y,N,N
^FD>;1234^FS
^FO570,260,1^BCN,30,Y,N,N
^FD>;12345678^FS
^FO570,330,1^BCN,30,Y,N,N
^FD>;123456^FS
^FO570,400,1^BY3^BCN,30,Y,N,N
^FD>;1234^FS
^XZ