Sign In
Products
ZPL ViewerBarcode GeneratorImage → ZPLZPL cheat sheetLabel DesignerTemplate Gallery
Developers
API QuickstartAPI ReferenceMCP ServerBulk GenerationWebhooksSDKs & ExamplesLimitsDirectPrint agent NewGitHub ActionVS Code extensionOn-Premise
Solutions
Logistics & ShippingE-CommerceERP & WMSManufacturingRetailHealthcare & LaboratoryAll solutions
Tools
ZPL Diagnostics HubZPL DebuggerSize & DPI AnalyzerDPI ConverterBarcode fit calculatorShipping Label AnalyzerFont InspectorOrientation DebuggerCalibration AssistantPrinter Compatibility CheckerBarcode Readability CheckerPrinter Language DetectorThermal Printer Test PackZPL ToolsEPL ToolsTSPL ToolsCPCL ToolsPrinter Language ConverterAll ToolsGuidesPricing
Language
EnglishTürkçeDeutsch
Home›Guides›Printing ZPL to a USB Zebra printer from the cloud

Printing ZPL to a USB Zebra printer from the cloud

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.

Why USB is different

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.

The queue must pass the bytes untouched

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.

Connecting the queue to a cloud API

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:

  1. Download the agent from the download page and pair it with a single-use code: labelixa-agent pair CODE.
  2. Register the cloud device with adaptor: "os_driver" (POST /v1/devices).
  3. List the queues on the machine: labelixa-agent discover -queues.
  4. Map the device to the queue: labelixa-agent map-printer -device DEVICE_ID -queue "QUEUE_NAME".
  5. Keep it running from every login: labelixa-agent install.

The full reference is in the API documentation.

What "delivered" means on this path

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.

What has been measured

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.

Check the label before it is printed

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.

Related guides

Why did my label print on the wrong printer?

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 Queue

Set 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 you

Every 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 browser

A browser cannot open a socket to port 9100. The three patterns that actually deliver ZPL from a web app, and what each one costs.

Try your own ZPL code →