In this article, you will learn…
How to set up the Zebra Printer driver via the Gateway Portal
How to add dynamic values to your print labels in Tulip
How to trigger print jobs in Tulip apps
Do you have a shipping or packing station on your production line? Are you able to print out customized labels in real-time as products are ready to be packed and shipped?
You can use a Zebra printer to create shipping labels in real-time with dynamic data from Tulip apps.
This guide will help connect your Zebra printer to the IoT Gateway and create a simple app that takes user input and creates a customized label. Let’s get started.
Capabilities and Requirements
Zebra printers can be called directly from the Windows Tulip Player on a device via the Zebra Network Printer Driver, or you can connect the printer to an IoT Gateway and follow the steps in this article.
In order for your Zebra printer to work with Tulip, it must have an Ethernet port and be connected to your network. Also, the IoT gateway must be connected to the same network as the printer.
Connecting Your Zebra Printer to an IoT Gateway
First, you need the IP address of the printer. In order to get this, you need to print a “network card” which will include the printer’s IP address. Follow these instructions to get a network card. It will look something like this:
Please note- if your network resets, your printer may get a new IP address. If that happens, you will need to redo this tutorial with the new IP address.
Then, select the “Zebra Printer” from the list of drivers and move the switch to “on”.
Configuring the Zebra Printer Driver
First, add the IP address of your printer in the appropriate text box. If the IP address contains leading 0s, ie 000, you should reduce them to a single zero.
For example, the IP address above was actually 010.000.000.224.
After that, click the “+” button next to the zplTemplates label to customize the driver. If you want to print multiple types of labels, you will want to create multiple templates.
Then, you will see two sections- “name of template” and “data”. “Data” will have a subfield called “zpl code”.
In order to proceed, you must be able to add the zpl code for the label you would like to produce. If you need to learn how to write ZPL code, check out their documentation.
If you want to include variables from Tulip apps in the ZPL code, you should add multiple zpl code fields. You will need to break up the code based on where you want the Tulip variables to fit in.
For example, imagine that you wanted to create the following label.
It has two custom fields- a title of “Hello?” and a custom barcode value. In order to allow Tulip variable values to be inserted into these areas on the barcode, you must break the code up into three separate ZPL code fields.
Here’s what that looks like in Tulip:
In between each ZPL code field, you will be able to add a variable value in the App Editor. The last field contains “^XZ, which indicates the end of the script.
If you want to experiment with different values in your ZPL code, we recommend Labelary. It has a text editor for editing ZPL. Make sure that the dots per inch (DPI) value matches the value on your printer.
Here’s an example from Labelary showing the “Hello?” text in place of a variable value from Tulip.
In the above example, if you are using “Hello?” as the first variable value from Tulip, you would copy all the code before “Hello?” into the first ZPL code field.
Click “Save” on the Zebra Printer driver page in the Gateway Portal, and then you are ready to set up your printing logic in an app.
Printing A Label From An App
Let’s create a quick test app that requires an operator to add 2 custom values via a Form Step, and then prints them in a pre-configured label. Reminder: this means that your Zebra driver should have three ZPL code fields.
Create a new app, and then create a form step with two fields: name and number. Both should be text fields. Save those fields in variables called “name” and “number” as well.
Then, add a step with variable text for each of those two fields, and a button named “Print”.
Create a trigger that will fire when the button is pressed. The “Then” statement should start like this:
"Run Device Function"
"At this station."
Since Tulip will communicate with the Zebra printer via the driver running on the IoT Gateway, you must attach the gateway to the same station that is running the test app in the Shop Floor tab.
Next, in the same “then” statement, you will see this line:
In this case, you are accessing a ZPL template called “kevin Demo”. Here’s the last line of the statement:
This is the line where you will add all the custom values from the app via the static text option. You must include a pipe operator “|” between each value, and add them in the order that you would like them to be inserted into the ZPL code.
In this case, you would add:
variable.name | variable.number
This means that the value in the “name” variable would be inserted between the first two fields of ZPL code, and the “number” variable would be inserted between the second and third fields of ZPL code.
Here’s what the ZPL code looked like:
Now it’s time to test the app. In order to do this, you need to publish the latest version of the app, since that is what will run at the Station.
After publishing the app, open the app in the Tulip Player and add fill out the form. Check to make sure that both fields appear in variable text in the following step, then press “Print”. Your label should print immediately on your Zebra printer.
Troubleshooting the Process
If your label does not print immediately, here are some things you can investigate:
Is the Zebra Printer connected to the same network as the Gateway via Ethernet?
Have you created a Station that has both the Gateway and the App running?
Do your custom values map to the open spaces in the ZPL code running in the driver?