A three-parcel AusPost shipment comes back from the carrier as one PDF with three labels in it. The first version of our print pipeline handed that PDF to macOS the obvious way, and macOS printed page one. Pages two and three — real labels for real boxes — never came out, and someone at the bench reprinted them by hand. Every time. That bug is why OrderOps has a print client.
Before that, the misery was more generic: browser print dialogs. Choose the printer, uncheck scale-to-fit, confirm — for every single label. Miss the checkbox once and the label prints at half size with a white border, and the sorting machine can't read the barcode.
A menu-bar agent on a loopback port
The print client is a small menu-bar app on the packing Mac. It runs a local HTTP server bound exclusively to 127.0.0.1 — connections from anywhere else are rejected at accept time. Pairing is one shot: the browser asks the agent for a nonce (five-minute TTL), the web app mints a token, the browser hands both back to the agent, done. No copy-pasting keys between windows. Every print call afterwards carries that bearer token, checked with a constant-time comparison.
From then on: the browser fetches the label PDF, base64-encodes it, and posts it to the agent with a label type. The agent looks the type up in its mapping table — label type to printer to paper size — and prints. No dialog. A test-print endpoint runs the same pipeline, so you can validate a mapping without burning a real label. Setup lives in the print client doc.
Every page, on the right media
Two fixes carry most of the weight. First, multi-page: a custom print view renders every page of the PDF onto its own media tile, aspect-fit, clip pagination — so the three-parcel PDF prints three full-size labels. Second, media snapping: the agent asks the printer driver what media it actually advertises, then snaps the requested paper size to the closest real one within a ±25% band per dimension.
requested : A6 (105 × 148 mm)
advertised : 4x6 in (101.6 × 152.4 mm), A4, Letter
±25% check : 4x6 in matches → snap
result : full-bleed label, barcode scansWithout the snap, an A6 request on a Zebra falls through to the driver's A4 default and the label shrinks by half. With it, A6 lands on the 4×6 stock that's actually loaded.
The ZPL shortcut
Some carriers hand us native ZPL. When one does, the agent can skip PDF rasterisation entirely and push the raw bytes straight at the printer's firmware through CUPS:
lp -d zebra-queue -o raw label.zplThe honest gaps: the agent doesn't auto-update. It's a signed, notarised app you replace by downloading a new DMG — deliberate for now, because you control the rollout on your own bench, but it's still a manual step. And it's macOS-only today; the Windows client is in transit. Direct mode and media sizes are covered in the ZPL doc.