Zebra label configuration

In Odoo, labels printed in the Zebra Programming Language (ZPL) file format are designed to fit a four-by-six inch label. To resize (or reformat) text to fit a variety of ZPL label sizes, navigate to the ZPL label view, and alter the ZPL code.

Warning

When customizing code in Odoo, please note that upgrading the database to newer versions may break custom ZPL code. Customers are responsible for maintaining their custom code.

Refer to the following sections for explanations, and example code, for frequently requested Zebra label customizations.

Adjust margin

Text gets cut off from standard ZPL labels printed in Odoo when the line exceeds fifty-five characters. To fit long product names, or lot numbers, on a single line, adjust the margin.

To begin, navigate to the ZPL code of the label in the Architecture tab. In the ZPL code for product labels, look for the ^FT command, which specifies where to start placing the text, or graphic element, on the label. The two numbers immediately following ^FT define the x-coordinate and y-coordinate in dots (similar to pixels for printers) from the left and top margins.

Important

When customizing lot/serial number labels, look for the ^FO command, instead of ^FT.

Example

The following is an example where the product’s name gets cut off with Odoo’s default ZPL formatting. In the Fixed tab, the x-coordinate of the starting position of the label is changed from ^FT100,80 to ^FT0,80, to fit the entire name.

Example barcode label with the product name cut off.

Code:

^XA^CI28
^FT100,80^A0N,40,30^FD[E-COM11] Cabinet with Doors (wood: Cherry, handles: brass)^FS
...
^XZ

Resize barcode

To adjust the size of the barcode to scale, begin by navigating to the ZPL code of the label in the Architecture tab. Look for the ^FO command (typically in the third line), which is the starting point of the margin for the barcode.

The ^BY command configures barcode size, and takes three numbers: bar width, width of wide bars relative to narrow bars, and bar height. By default, ZPL code in Odoo uses ^BY3, setting the bar width to three dots, a typical size that is easy for barcode scanners to read.

Example

To shrink the barcode to scale, ^BY3 is reduced to ^BY2.

Example barcode label.

Code:

^XA^CI28
...
^FO100,160^BY3
...
^XZ

Rotate elements

To rotate elements in ZPL, begin by navigating to the ZPL code of the label in the Architecture tab.

The ^BC command’s first parameter (information that affects the behavior of the command) defines the rotation of an item, which can be:

  • N: display normally

  • R: rotate 90 degrees

  • I: rotate 180 degrees

  • B: rotate 270 degrees

Example

To rotate the barcode, ^BCN is changed to ^BCB.

Example barcode label.

Code:

^XA^CI28
...
^BCN,100,Y,N,N
...
^XZ