WxPrint
ToolsOverview
WxPrint is a cross-platform print service for web pages and backends, available on Windows, macOS, and Linux. Built entirely in Rust, it lets a web page or any backend language (Java, Python, Go, PHP, Node.js, C#, C/C++, Ruby…) submit a template and data over HTTP or WebSocket; WxPrint renders the document server-side and sends it straight to a local printer — no browser print dialog, no plugin, no external runtime.
The component ships in three parts that share one service core:
- wxprint-tray (resident tray) — the desktop default. It lives in the system tray, starts on login, and brings up the embedded print service automatically. The tray menu pauses/resumes the service, switches languages, and checks for updates; a settings dialog configures the listen address, authentication, TLS, autostart, and UI theme. Print previews open in a native window — paging, zoom, panning, and a millimeter ruler included — and you can switch printer, paper, and orientation before committing to paper.
- wxprint-server (headless service) — a standalone process for servers and print-dedicated machines. One command registers it as a system service (systemd / OpenRC / sysvinit / launchd / rc.d / Windows service) for unattended operation.
- wxprint-designer (print designer) — a visual template editor: import a scanned background, calibrate physical size, drag elements into place, bind variables, preview live with sample data, and fire a test print; it also edits HTML/Twig templates directly (source + data dual editors, previewed through the same pipeline as the server).
Two Template Kinds, One Render Pipeline
- Overlay templates — a JSON document describing the page and elements in physical millimeters (0.01mm precision). Print variable content precisely onto pre-printed forms (invoices, waybills, certificates, labels): text, lines, rectangles, images, barcodes (Code128/EAN13/EAN8/Code39/ITF14/UPCA), QR codes, tables, and charts. The background scan is a design-time tracing aid and is not printed by default.
- HTML templates — write full HTML+CSS with Twig syntax (
{{ }},{% for %}, filters); the server injects data and lays the document out with the built-in engine, paginating automatically — ideal for reports, statements, and manuals.
Both pipelines emit vector PDF: text is embedded as glyphs (no jaggies, copyable), barcodes and QR codes are drawn as vector paths, tables and charts align exactly. Preview, print, and PDF export all go through the same render path — what you see is what prints.
Printing Power
- Batch continuous printing — a batch of N records becomes one job that feeds paper continuously, avoiding per-item submission stalls; per-record copies (triplicate forms), whole-batch copies, and page-order control (collate) are all supported.
- Continuous and custom paper — any page width/height (e.g. 100×93.5mm waybill rolls, 58mm receipts) with zero gap feeding; presets cover A3/A4/A5/A6/B4/B5/Letter/Legal plus fully custom sizes.
- Headers, footers, page numbers — elements can repeat on every page (header/footer) or appear only on the first/last page; built-in
{{page}}/{{pages}}variables. - Printer negotiation — enumerate printers with state (ready/offline/out-of-paper), trays, duplex, and media sizes; submissions can specify copies, page selection (“1-3,5”), tray, and duplex.
- Overlay calibration — print a calibration page, measure the offset, and store per-printer offset/scale corrections (readable and writable over the API) that absorb mechanical drift; template-level tweaks stack on top of the printer calibration.
- Preview before paper — submit a render-only preview job and the tray pops the native preview window; confirm and hit “Print”. Or submit with a printer name to print directly (high-volume waybill/receipt scenarios).
- Export — any job can be exported as PDF (save-as), PNG (first page), or ZIP (per-page PNGs).
Integration
- HTTP API (REST) — stateless request/response for any HTTP client: submit and get a
job_id, poll status when needed. Templates and data can be inline, referenced by id, or fetched from a URL at print time. - WebSocket — the direct print channel for web pages: one message submits, and accepted/progress/done events stream back in real time, no polling, automatic reconnection.
- JS SDK — the server hosts
wxprint.js, wrapping both protocols intowxprint.print({...})methods and event callbacks; it switches to wss automatically when the page is served over HTTPS. - Imperative script API — Lodop-style verb sequences (
init→loadData/loadURL→add_text/add_barcode/add_html… →print) build print content programmatically without template files; the server compiles them through the same render pipeline. - Rich examples — HTTP samples in 8 backend languages (Python/PHP/Node.js/Java/Go/Rust/C/C++/C#/Ruby), 3 browser demos, and a feature gallery covering 23 sample categories (paper/text/graphics/barcodes/images/tables/HTML pipeline/13 chart types/output control) — all runnable out of the box.
Security & Deployment
- Binds to
127.0.0.1:8899by default (local only); switch the bind address to expose it on the LAN. - Token authentication (Bearer /
X-Wxprint-Token/ WS?token=), HTTPS/WSS (custom certificate or one-click self-signed), fetch size/timeout limits, and a sandboxed template engine (Twig has no I/O; HTML never executes JS). - Three config sources with clear precedence: CLI flags > environment variables >
~/.wxprint/config.json; the tray settings dialog edits the same file visually. - Packages for every platform: Linux deb/rpm/pacman/apk/tar.gz/AppImage (Ubuntu, Debian, Deepin, UOS, Mint, CentOS, Rocky, Fedora, openSUSE, Arch, Manjaro, Alpine…), macOS DMG/PKG, Windows NSIS installer, and FreeBSD/NetBSD/OpenBSD packages.
Personalization
- 21 interface languages — Simplified Chinese, Traditional Chinese (Taiwan and Hong Kong), English, Japanese, Korean, German, French, Spanish, Portuguese, Italian, Dutch, Polish, Russian, Swedish, Turkish, Arabic, Hindi, Thai, Vietnamese, and Indonesian; switching takes effect immediately in tray and designer, and RTL languages such as Arabic mirror the interface layout automatically.
- Dark & light themes built into both the tray settings and the designer.
- Update checks included in tray and designer to keep the component current.
Getting Started
- Install and start — after installing the package, launch wxprint-tray (usually autostarted); the tray icon lighting up means the service is ready. On a server,
wxprint-server --installregisters the system service. - First print — open the demo pages (
examples/websocket/) in a browser and click any sample card: the preview window opens, pick a printer and hit “Print”. Backend folks can run the scripts underexamples/http/<language>/. - Build your own template — open wxprint-designer, create a template, drag in elements, bind variables, paste sample JSON to preview, save, and submit by template id.
Who It’s For
- E-commerce & logistics — batch waybill overlay printing, direct receipt output, triplicate continuous printing.
- ERP/CRM/OA integrators — web pages or backends driving local printers for invoices, statements, delivery notes, and reports.
- Label & ticket printing — warehouse labels, price tags, asset tags, hospital wristbands.
- Unattended printing — cron jobs or message queues triggering prints from a registered system service.
- Lodop migrants — a complete feature-parity matrix (verbs, overlay backgrounds, preview components) with a clear manual migration path.
FAQ
Can a web page really drive the local printer?
Yes. The page connects to the local WxPrint service over WebSocket (default ws://127.0.0.1:8899/ws) and submits the job; the service does the printing — not the browser print dialog. No headers/footers/watermarks, and coordinates are accurate to 0.01mm.
Do I need a browser or Node.js runtime installed? No. WxPrint is a pure Rust native implementation — a single executable; the HTML layout engine is built in.
How’s the print quality on Windows? Windows output goes through GDI, rasterized at 600 DPI by default — overlay text looks on par with native laser printer output. Linux/macOS hand the vector PDF straight to CUPS for the best text quality.
What if the data is only known at print time?
Pass a data URL in the request (auth headers supported) and the server fetches it before rendering; the script API’s loadURL verb does the same. Templates and data can both be fetched at print time.
Will switching printers break overlay alignment? Each printer gets its own calibration (offset + scale) — print the calibration page and measure once; template-level tweaks stack on top for individual documents.
Can several machines share one print server on the LAN?
Yes. Change the bind address to 0.0.0.0 (enabling the token is recommended) and every machine on the network can submit print jobs.
Closing
If you’re looking for a print service that is browser-independent, cross-platform, API-complete, and overlay-precise — direct web-page connection, backend integration, batch continuous output, a visual designer, a native preview window, and 21 languages — WxPrint packs all of it into one pure-Rust package.