Home Blog Label Printing in Odoo and ZPL Commands
Label Printing in Odoo and ZPL Commands

Label Printing in Odoo and ZPL Commands

If you are an Odoo user, you know that the main essence of odoo is its ability to manage all your business requirements in one place.

Like many other services, Odoo also provides various label printing options to its customers. Labels act as the identity of the products to allow customers to distinguish one product/brand/record from another.

Odoo provides the option to print labels of its products in PDF as well as in ZPL format.

Odoo Provide option to Print Labels of Products in PDF
Odoo Provide option to Print Labels of Products in PDF

Here, as we can see, Odoo provides us an option to print a PDF of the product label like this:

And if we choose to select Product Label(ZPL), it provides us with a .txt file containing the ZPL commands to produce a label.

So the first question that comes to our mind is... What is ZPL?

Zebra Programming Language (or ZPL)  is a command-based language used by the printer as instructions for creating the images printed on the labels.

Odoo Provide option to Print Labels of Products in PDF

According to the definition, ZPL is a page description language from Zebra Technologies, used primarily for labeling applications. ZPL can be used to design interactive zebra labels for ZPL or Zebra printers. ZPL is one of the most commonly used printer languages. Printer languages are the languages that we used to command the printer to do something.

There are a number of printer languages developed by different printing organizations. Zebra Printing Technologies use ZPL. ZPL II is the latest version of the ZPL that is currently being used to design labels.

So, this was the explanation of what ZPL is. Now, what if we want a different ZPL label for our product, and how can we directly print the label to the network printer? So the question is, how can we design this ZPL label if we want to?

 Join our Subscriber list for Odoo tips, technical insights, and more!


In this blog, we’ll be discussing how we can design labels using ZPL and how we can work with ODOO to print ZPL labels directly to Zebra Printers.

Using ZPL, we send commands to the printer to define the length and width of the label and other basic commands to design labels according to our needs. Although, there are numerous commands mentioned in the ZPL programming guide, which can be very confusing and lengthy to find.

Here, we’ll discuss some of the basic and commonly used commands.

The commands in ZPL always start with a caret(‘^’) or tilde sign(‘~’). There are almost 200 different commands present in ZPL II.

The format of a label always starts with a ‘^XA’ command and ends with a ‘^XZ’ command.

So, first of all we’ll see how we can print a simple product name on the label.

'^XA',
'^CF01,30,50',
'^FO40,70^FWN^FD' PRODUCT '^FS',
'^XZ',

Print Simple Product name on lable

This code would generate a label like this. This is a 40*30 mm label used here.

In this code, as we discussed, the label starts with  ‘^XA’ command and ends with ‘^XZ’ command. If any of these is not present in the code, the label would not be generated.

'^CF01,30,50' : It is used for defining the fonts style, height ,and width.

- The 1st element is the specified default font, and its values range from a to z and 0 to 9.

- The 2nd element is the height of the font. The initial value is 9 and it ranges from 0 to 32000.

- The 3rd element is the width of the font and its values are the same as the height.


Important Note:
Once you define fonts for your label, it is globally defined for all the fonts until you define them again.

FO40,70 is the field origin(FO) and its values are (x,y), and it denotes the positioning of fields based on the X and Y axis. FS is used for field separators. The data between FO and FS is displayed as a string on the label positioned on the coordinates mentioned.

Now, let us see how we can generate a product label with a barcode on it.

'^XA',
'^CF01,30,50',
'^FO40,70^FWN^FD' PRODUCT '^FS',
'^BY1,2,60',
 '^FO70,130^BC^FD'+barcode+'^FS',
'^XZ',

This will generate a barcode like this.

Generate Product LAbel with a Barcode

BY is used to set a default configuration for barcodes.

- The 1st element denotes the width of the barcode.

- The 2nd element denotes the width ratio of the barcode.

- The 3rd and final element denotes the height of the barcode.


Next, in the Field data, we define the field origin or we can say the positioning of the barcode according to x and y-axis. Then we define the barcode by ‘^BC’. And then, the data is the barcode number to be integrated.

Here, ‘BC’ is used to draw Code 128 barcode. We have other barcodes in odoo also like,

BD :  UPS MaxiCode bar code

BE : EAN 13 bar code

BF : MicroPDF417 bar code

BI : Industrial 2 of 5 bar code

BJ : Standard 2 of 5 bar code

BU : UPC-A bar code

We can also generate QR code in labels by using ‘BQ’ command.QR stands for the quick response and this can also be used as a great way to access information.

'^XA',
'^CF01,30,50',
'^FO40,70^FWN^FD' PRODUCT '^FS',
 '^FO100,130^BQ,2,4^FD'+barcode+'^FS',
'^XZ',

Generate QR code :Example

Using this code will generate a QR Code like this. We don’t need to define barcode field defaults (BY) in the case of QR codes.

The ^BQ command produces a matrix symbology consisting of an array of nominally square modules arranged in an overall square pattern. A unique pattern at three of the symbol’s four corners assists in determining bar code size, position, and inclination.

There is no height and width defined for QR Codes. The elements used in QR codes are :

a = Field orientation

b = model (there are 2 options 1 and 2, 2 is enhanced form and set by default)

c = magnification factor, which defines the magnification or size of the barcodes (its values range from 1 to 10).

One of the most common questions that come to mind is what to do in case you want to align your field data or data in the label vertically, say the internal reference number of a product needs to be aligned in a vertical form like this.

Align your Field Data or Data in Label Vertically

We can do this simply like this:

'^XA',
'^CF01,20,20',
'^FO10,50^FWB^FD'+default_code+'^FS',
'^CF01,30,50',
'^FO40,70^FWN^FD' PRODUCT '^FS',
 '^FO100,130^BQ,2,4^FD'+barcode+'^FS',
'^XZ',

 

Here, in  '^FO10,50^FWB^FD'+default_code+'^FS', we have defined the FWB where ‘B’ denotes the field orientation.

N = Normal Orientation

R = Rotated 90 Degress Orientation

I = Inverted 180 Degress Orientation

B = Read from bottom up, or 270 rotation.

^FR command: Field Reverse Print

The ^FR command allows a field to appear as white over black or black over white. When printing a field and the ^FR command has been used, the color of the output is the reverse of its background. Following these simple commands, we can easily design our own zebra labels.

Now, How can we Print the Zebra Labels Directly to the Printer in Odoo?

There is a number of ways to print labels on a printer using the web application. We can print the labels using some very good JS tools which send the ZPL program data directly to the printer.

Some of the most commonly used JS web tools for printing through the network are QZ Tray and JSPM by neodynamic. They are free to download and use but there are some inside purchases if you want for enhancement. Like QZ tray asks permission during printing, you can simply by certificates so that it doesn’t ask again for permission.

Here are the Download links for the Web Tools

JSPM by neodynamic

QZ Tray

Odoo, by default, does not provide the option to print ZPL directly to a Zebra Printer. But we have a module that can be used for automating this process in Odoo. All we need to do is have QZ tray installed and we can directly send the print to a network printer for various labels. It provides us with the option to print various labels like shipment labels and barcode location labels also.

You can contact our Team of Odoo Developers to get assistance regarding the same. Want to Explore more details about the module, Click Here:- Label Printing From Zebra Printer

Book a Free Odoo Consultation


Watch Video to learn " How To Print the Zebra Labels Directly to the Printer in Odoo"


Get in touch wit​h us!

Protected by reCAPTCHA, Privacy Policy & Terms of Service apply.
Leave a Comment

Your email address will not be published.

Submit
Your comment is under review by our moderation team.