v147 · JavaScript API · Isolated Web Apps
Web Printing API
Query local printers, interrogate their capabilities, and submit precisely-configured print jobs — programmatically, from JavaScript, using Internet Printing Protocol semantics. Shipping in Chrome 147 for Isolated Web Apps.
window.printing is restricted to apps packaged as Isolated Web Apps (IWA). These demos simulate the full API surface — the code shown is the real API, running against a faithful mock.
concepts
-
Printer Discovery
Call
window.printing.getPrinters(), inspectWebPrinter.cachedAttributes(), fetch detailed attributes withWebPrinter.fetchAttributes(), and explore capabilities: supported media sources, colour modes, duplex options, and resolution ranges before sending a single page. -
Print Job Builder
Configure a full IPP print job — copies, orientation, duplex, media source, colour mode — then submit it with
WebPrinter.submitPrintJob(). WatchWebPrintJob.onjobstatechangemove throughpending → processing → completed. -
Receipt Formatter
Design a thermal receipt with editable line items, store name, and paper width. The live preview mirrors a fixed-width receipt printer layout, while the job lab exercises
window.printing.getPrinters(),fetchAttributes(),submitPrintJob(),cancel(), andDataErrorfailure modes. -
Print Preview Builder
A visual print layout designer with paper size selector, orientation toggle, margin sliders, and add-content buttons (heading, text, table, page break). The live preview updates at 8.5×11 scale. "Send to printer" uses the Web Printing flow when available or falls back to
window.print(). A capabilities panel shows supported paper sizes, duplex, colour modes, and resolution. -
Compatibility Lab
Probes
window.printing(Isolated Web Apps only),window.print(), and the fallback capability chain. Runs a live detection of IWA context and print API availability, and provides the feature-detection waterfall from Web Printing API down towindow.print().
why it shipped
window.print() gives developers a one-shot print dialog with no programmatic control. For kiosk apps, document-management systems, point-of-sale software, and manufacturing dashboards built as Isolated Web Apps, that is not enough — they need to select a specific printer, choose duplex, set the number of copies, specify media type, and respond to job errors programmatically. The Web Printing API exposes IPP (Internet Printing Protocol) — the same protocol used by CUPS, macOS, and Windows print subsystems — directly from JavaScript via window.printing. The API is scoped to Isolated Web Apps because it grants access to local network printers without a user dialog for every job, a privilege unsuitable for arbitrary web origins.
references
implementation reference
Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗