archit
archit

Reputation: 185

ZPL - How can we control width of the barcode in zpl

I am working on conversion of pdf in to ZPL. I am using zebra programming language(zpl). I am trying to control the barcode(any barcode) width using By command. ^By4 is giving lower width and ^By5 is going out of the box. My use case is I want to achieve narrow bar width in float number(here 4.5). We can not pass float number in By command. Please let me know if we can achieve this using some other method in ZPL.

Upvotes: 1

Views: 7607

Answers (1)

charlesbridge
charlesbridge

Reputation: 1212

You don't mention what barcode format you're using. Some of them, like 2of5, can also accept the ratio parameter for ^BY. The default is ^BY2,3, changing that to ^BY2,2 can make a smaller version:

^XA
^POI
^CFO,20
^BY5,3
^FO100,400
^BJN,100,Y,N
^FD200940^FS
^BY5,2
^FO100,700 
^BJN,100,Y,N
^FD200940^FS
^XZ

This generates two barcodes in 2of5, one with the default ratio and one with a smaller ratio. The second one has a tighter barcode that uses less space. Valid values are 2.0-3.0 (although many round off to the same values) so there is some flexibility. Please note, this only works with barcode formats that are not fixed ratio formats.

You can check the manual page for ^BY in the ZPL programmers guide, p123, for the table that shows valid values and which ones round off to the same value (ie, 2.0 and 2.1 give the same results)

Upvotes: 2

Related Questions