ZPLToolkit

^BB

CODABLOCK Bar CodePreview: partial

Code 128 stacked into a block of rows, for when a linear code would be too long to fit the label.

Syntax

^BBo,h,s,c,r,m

Parameters

ParameterDescription and accepted valuesIf omitted
oRotation of the bar code on the label.N normal, R 90°, I 180°, B 270°Last ^FW value, else N
hHeight of an individual row in dots, not of the whole block.2 to 32000 dots — height of one row8
sSecurity level — how much error correction the symbol carries.0 to 3 — security level2
cNumber of data columns. Leave it out and the printer chooses.2 to 62 — data columnsChosen by the printer
rNumber of rows. Leave it out and the printer chooses.2 to 44 — rowsChosen by the printer
mCODABLOCK mode. F is the one nearly every specification means.A, E or F — CODABLOCK modeF

How it works

^BB prints CODABLOCK, which takes the data a Code 128 would carry and stacks it into rows. Mode F — the default and the only one in common use — builds each row as a Code 128, so a scanner that reads linear codes can read a CODABLOCK a row at a time and reassemble it.

It exists for the case where the data is too long for one row but a true 2D code is not an option, usually because the installed scanners are linear. Blood bank labels and some pharmaceutical specifications still call for it.

As with Code 49, the height parameter is the height of one row. The column and row counts can be fixed, but leaving them to the printer produces the tightest block the data allows.

Example

ZPL
^XA
^BY2,3,80
^FO60,60^BBN,20,3,,,F^FDZPL TOOLKIT^FS
^XZ

Rendering…

CODABLOCK F in mode F, rows 20 dots tall, with the printer choosing the block shape.
Open in the viewer

How the preview on this site handles it

Drawn with a real CODABLOCK F encoder, so it scans, and rotation is applied. The security level, column and row counts are left to the encoder: setting `s`, `c` or `r` does not change the preview, though it does change what the printer produces.

Common mistakes

  • Reading `h` as the height of the whole block. It is one row, and the block is that height times the row count.
  • Requesting modes A or E. They exist in the command but almost nothing reads them; F is what specifications mean by CODABLOCK.
  • Using it where a 2D code would do. If the scanners are imagers, ^BX carries the same data in far less space.

See also