i'd like to know how to center barcode code 128. on the picture you should see that it is right now left justified.
my zpl:
^XA
^LH10,10
^FO0,0^XGE:SWESE001.GRF^FS
^FO440,0^XGE:SWESE000.GRF^FS
^FO0,70^FB550,50,0,C,0^AQN,25,30^FDSpraynozzle 50mm^FS
^FO0,130^BY2^BCN,30,Y,Y,N,N^FDS/N:941001-0114-0001^FS
^FO180,170^AQN,23,20^FDwww.swepro.com^FS
^XZ
I'm posting my solution in case someone is looking for it. As E_S mentions, in order to center a barcode in a label you have to calculate it by code following these steps:
(^BY2)
(eg: 8 dots / mm)
. so if you have a 80 mm
wide label, 80 * 8 = 640 dots
(">:", ">5", etc.)
count as one character, and that characters in mode C
are stored in pairs. For more information on mode C
, refer to http://en.wikipedia.org/wiki/Code_128>:S/N:941001-0114-0001
you have to count [start code B] + [20 characters] + [check digit] = 22 >:S/N:>5941001>6->50114>6->50001
you have to count [start code B] + [4 characters for 'S/N:'] + [mode C invocation] + [3 characters for '941001'] + [mode B invocation] + [1 characters for '-'] + [mode C invocation] + [2 characters for '0114'] + [mode B invocation] + [1 characters for '-'] + [mode C invocation] + [2 characters for '0001'] + [check digit] = 20
stop code
that has 2 extra units (that is a total of 13)((chars counted [22 or 20] * 11) + (stop char * 13)) * narrow bar width = 510 dots or 466 dots
round((label width - barcode width) / 2)
and use that to position the barcode with ^FT
That's it! Hope it helps someone!