^BY
Bar Code Field DefaultPreview: partialSets the module width, ratio and height that following barcodes inherit. Module width is the main lever on whether a barcode scans.
Syntax
^BYw,r,hParameters
| Parameter | Description and accepted values | If omitted |
|---|---|---|
| w | Module width — the width of the narrowest bar, in dots.1 to 10 dots | 2 dots |
| r | Wide-to-narrow bar ratio, for the symbologies that use one.2.0 to 3.0 in 0.1 steps | 3.0 |
| h | Default barcode height in dots.1 to 32000 dots | 10 dots |
How it works
^BY sets the defaults every following barcode uses unless it overrides them. The first parameter, the module width, is the width of the narrowest bar in dots and is the single most important value for scannability: too small and the scanner cannot resolve the bars, too large and the symbol runs off the label.
At 203 dpi a module width of 2 or 3 is the usual choice. At 300 dpi the same physical bar needs a larger dot value, so a template moved between resolutions without adjusting ^BY produces a barcode that is physically half the size it should be.
The wide-to-narrow ratio applies only to the barcodes that have wide and narrow bars, such as Code 39 and Interleaved 2 of 5. Code 128 and QR ignore it. The height parameter sets a default that ^BC and friends can override per field.
Example
^XA
^BY3,3,80
^FO60,60^BCN,80,Y,N,N^FD12345678^FS
^XZRendering…
How the preview on this site handles it
Module width and height are applied. The wide-to-narrow ratio is parsed but not used, which is harmless for Code 128 and QR — the two symbologies the preview currently draws.
Common mistakes
- Carrying a ^BY across resolutions. A module width of 2 at 203 dpi needs to be 3 at 300 dpi for the same physical size.
- A module width below 2 at 203 dpi. Most scanners will not read it reliably.
- Forgetting that ^BY has to come before the barcode command, not after it.