DEVELOPERS / ZPL / ZEBRA
How to Send ZPL to a Zebra Printer
Send a ZPL file to a Zebra printer over the network (port 9100), from Windows, from Linux with CUPS, or through an API from any server. Copy-paste commands for each.
^XA^FO50,50^A0N,40,40^FDHello from LabelInn^FS^XZTHE PROBLEM
You have a .zpl file, or a ZPL string your code generated, and you want it on a label. Zebra printers do not need a driver to understand ZPL; what they need is the raw bytes, unchanged. Here are the ways to get them there, from a one-line command to an API that works from anywhere.
Every example sends this test label:
^XA^FO50,50^A0N,40,40^FDHello from LabelInn^FS^XZ01 / ZPL
1. Over the network: port 9100
Networked Zebra printers listen for raw data on TCP port 9100. From any machine on the same network:
# macOS / Linux
nc 192.168.1.50 9100 < label.zpl# Windows PowerShell
$client = New-Object System.Net.Sockets.TcpClient("192.168.1.50", 9100)
$bytes = [System.IO.File]::ReadAllBytes("label.zpl")
$client.GetStream().Write($bytes, 0, $bytes.Length)
$client.Close()02 / ZEBRA
2. On Windows, through a shared printer
If the printer is installed on Windows and shared, copy the file to the share in binary mode so nothing is converted:
copy /B label.zpl \\localhost\ZebraShare03 / PORT 9100
3. On Linux or macOS, through CUPS
Send the file as raw data so CUPS does not try to render it:
lp -d Zebra_ZD421 -o raw label.zpl05 / ZPL
5. From anywhere: through an API
Methods 1 to 4 only work when the sender can reach the printer, and none of them tells you whether the label actually printed. LabelInn runs next to the printer, connects out to the cloud, and gives you one HTTPS endpoint:
curl https://labelinn.com/v1/print/jobs \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{"printer_id":"prt_abc123","payload_type":"zpl","payload_data":"^XA^FO50,50^A0N,40,40^FDHello from LabelInn^FS^XZ"}'The job is queued if the printer is off, delivered when it is back, and its status can be read with GET /v1/print/jobs/{id}. LabelInn also reads the printer back over USB, network and Bluetooth, so "ribbon out" is reported instead of silently swallowed.
06 / ZEBRA
When ZPL does not print
- Nothing happens: check that the label starts with
^XAand ends with^XZ. - ZPL text prints on the label: the printer is in a different language mode, or a driver re-rendered the data. Send raw.
- Wrong size or position: the printer's resolution differs from what the ZPL was written for. Use our ZPL viewer to check the label before sending it.
Printing through the API is part of the Pro plan, and the free trial includes it. Keys that start with sk_test_ run against a sandbox that never prints, so you can build and test before going live. See pricing.
QUESTIONS / FAQ
Frequently asked questions
How do I send a ZPL file to a Zebra printer?
On the same network, send the raw file to TCP port 9100 (for example nc 192.168.1.50 9100 < label.zpl). On Windows, copy /B to the shared printer; on Linux or macOS, lp -o raw. From any other network, send it through an API such as LabelInn's.
Do I need a Zebra driver to print ZPL?
No. The printer interprets ZPL itself; it only needs the bytes unchanged. A driver can even break raw ZPL by rendering it as text.
What port does a Zebra printer use for ZPL?
TCP port 9100 for raw printing.
Why does my ZPL print as text?
Something converted the data before it reached the printer, usually a driver or a non-raw print path, or the printer is set to another command language. Send the file raw.
KEEP GOING
Related
NEXT STEP / LABELINN
Send ZPL from anywhere
Register the printer once, then send ZPL from any server, script or app. · One HTTPS endpoint · Queued if the printer is off · Printed status comes back