Published:
Most guides to raw ZPL printing assume a network printer: open a socket to port 9100 and write the label. A desktop printer on a USB cable has no such port. It is reachable only through the computer it is plugged into, and that changes how a cloud application gets a label onto it.
A USB printer shows up as a print queue in the operating system — the spooler on Windows, CUPS on macOS and Linux. Nothing on the network can address it directly, so a server in the cloud cannot reach it the way a network printer is reached. Something on that computer has to receive the label and hand it to the queue.
A printer driver normally renders a page and sends the printer its own
commands. For ZPL that is wrong: the label language must reach the printer
exactly as written. On macOS and Linux the job is submitted with
lp -d QUEUE -o raw; on Windows the job uses the RAW data type.
We measured the macOS case on a Zebra GK420d over USB: the queue created
with the "Zebra ZPL Label Printer" driver passed raw ZPL through unchanged
and the printed label matched the on-screen preview. A driverless raw queue
works the same way.
The Labelixa DirectPrint agent is a small program on the computer the printer is attached to. It collects print jobs from the Labelixa API over an outbound connection — no inbound port is opened — and passes each one to the queue as raw data. Setup:
labelixa-agent pair CODE.adaptor: "os_driver"
(POST /v1/devices).labelixa-agent discover
-queues.labelixa-agent map-printer -device
DEVICE_ID -queue "QUEUE_NAME".labelixa-agent
install.The full reference is in the API documentation.
On a USB queue the furthest stage a job can report is
submitted_to_os: the operating system accepted it. The queue
does not report printer status, so a printer that is switched off or out of
labels is visible in the operating system's queue, not in the job record. We
measured this: a job sent while the printer was off was reported as
delivered, waited in the macOS queue, and printed once the printer was
switched on — the agent did not resend it, so nothing printed twice. A
three-copy job produced three labels.
Everything above was measured on macOS (Apple Silicon) with one Zebra GK420d over USB, including the agent starting again after a restart. The same commands exist on Windows and Linux, but we have not yet verified printed output on those systems; check the first labels before you rely on them.
A thermal printer has no undo. Render the ZPL in the
ZPL viewer or through the render API first
— it catches fields outside the label, a missing ^XZ and
barcode data that cannot be encoded before any media moves.
Labels landing on the wrong printer are an identity problem, not bad luck: queue names, DHCP leases and shared drivers. How to diagnose and stop it.
Printing ZPL on macOS and Linux with a CUPS Raw QueueSet up a raw CUPS queue with lpadmin, send ZPL with lp, and avoid the classic trap: a filtering queue that prints your ZPL code as plain text.
Printer identity: why queue names and IPs betray youEvery layer of the label printing stack identifies a printer by something mutable: a queue name, a port mapping, a DHCP lease. Anatomy of jobs going astray.
Printing ZPL from a browserA browser cannot open a socket to port 9100. The three patterns that actually deliver ZPL from a web app, and what each one costs.