- Print
How To Integrate a Zebra Printer with Tulip
Purpose
Learn how to setup the Zebra Printer driver and trigger new print jobs from frontline operations apps.
In this article, you will learn…
- How to set up the Zebra Printer driver via the Device Portal
- How to add dynamic values to your print labels in Tulip
- How to use Triggers to 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 Edge Device and create a simple app that takes user input and creates a customized label.
Capabilities and Requirements
Zebra printers can be called directly from Tulip in a few different ways depending on the type of device running the Tulip Player and the printer capabilities. See below for a matrix:
Tulip Player | Networked Zebra Printer? | Connection Mechanism | Notes |
Windows Device | Yes | Zebra network printer driver | Many-to-many |
Windows Device | No | Serial driver One-to-one connection over serial port | |
Non-Windows Device | Yes | Zebra printer driver and Edge device (see below) | One-to-one printer connection to Edge device |
Non-Windows Device | No | Not supported | N/A |
Connecting Your Zebra Printer to an Edge Device
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:
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, sign into the Device Portal on your computer, and choose the “Drivers” option on the left menu.
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
- 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?”
- 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 Device Portal, and then you are ready to set up your printing logic in an app.
Printing A Label From An App
As of r235, Form steps have been disabled for all new Tulip Instances. Reach out to support@tulip.co to enable Form Steps on your instance.
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
- 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 fires when the button is pressed. The Then statement should start like this:
- "Run Device Function"
- "Zebra Printer"
- "Custom template"
- "At this station."
Since Tulip will communicate with the Zebra printer via the driver running on the Device Portal, you must attach the Edge Device 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 looks 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 Edge Device via Ethernet?
- Have you created a Station that has both the Edge Device and the App running?
- Do your custom values map to the open spaces in the ZPL code running in the driver?
Did you find what you were looking for?
You can also head to community.tulip.co to post your question or see if others have faced a similar question!