A ZPL file does not need a driver to be printed. Most networked thermal
printers listen on TCP port 9100 ("raw" / "JetDirect" printing) and
treat everything that arrives there as printer commands. Printing a
label is just moving bytes to a socket.
Linux / macOS
nc 192.168.1.50 9100 < label.zpl
That's it. netcat, no CUPS queue, nothing to configure.
Windows
PowerShell opens the same socket without extra tools:
$c = New-Object Net.Sockets.TcpClient('192.168.1.50', 9100)
$b = [IO.File]::ReadAllBytes('label.zpl')
$c.GetStream().Write($b, 0, $b.Length); $c.Close()
From code
Any language with TCP sockets can print. Python:
import socket
with socket.create_connection(("192.168.1.50", 9100), timeout=5) as s:
with open("label.zpl", "rb") as f:
s.sendall(f.read())
The catch: 9100 gives you no feedback
There is no response protocol in the simple case. The socket closing
without an error means the printer accepted the bytes — not that
the label printed correctly. Density mismatches and layout bugs are
invisible here. So preview first: paste the ZPL into an
online viewer (disclosure: I
work on Labelixa) and catch the missing ^FS before the printer does.
Port 9100 has no undo; every mistake costs a label and ribbon.
When nothing prints, in order
-
pingthe printer — if that fails it's a network problem, not ZPL. - Is 9100 open? Some printers ship with raw printing disabled or on another port — check the printer's network config page.
- Paused or in an error state? A blinking light means the job is queued inside the printer, not lost.
- Is the ZPL actually a label? Everything must sit between
^XAand^XZ— a file without that frame is silently ignored (the #1 "it does nothing" cause). - Prints, but wrongly? Different problem class — that one is about
density,
^FSand clipping.
Top comments (0)