v147 · Printer Discovery
Printer Discovery
Call navigator.printing.getPrinters() to enumerate local printers, then drill into each printer's IPP attributes — media sizes, colour modes, resolutions, duplex support — before sending a single page.
IWA simulation. In a real Isolated Web App,
navigator.printing.getPrinters() returns live printers from your OS. This demo uses a mock that mirrors the real API shape.
navigator.printing.getPrinters()
ready
// Console output will appear here
- Click the button to discover printers.
API code
// Only available in Isolated Web Apps (IWA)
if ('printing' in navigator) {
// 1. Discover all local printers
const printers = await navigator.printing.getPrinters();
// printers: Printer[]
for (const printer of printers) {
console.log(printer.name); // "HP LaserJet Pro"
console.log(printer.isDefault); // true | false
console.log(printer.status); // "idle" | "processing" | "stopped"
// 2. Fetch full IPP attribute set for this printer
const attrs = await printer.getAttributes();
// Media sizes the printer supports
console.log(attrs['media-size-supported']);
// [ "iso_a4_210x297mm", "na_letter_8.5x11in", ... ]
// Supported colour modes
console.log(attrs['print-color-mode-supported']);
// [ "color", "monochrome", "auto" ]
// Resolution options (dots per inch)
console.log(attrs['printer-resolution-supported']);
// [ { xRes: 300, yRes: 300 }, { xRes: 600, yRes: 600 } ]
// Duplex options
console.log(attrs['sides-supported']);
// [ "one-sided", "two-sided-long-edge", "two-sided-short-edge" ]
}
}
see also
- Print Job Builder — submit a configured print job
- ChromeStatus entry
- WICG/web-printing spec
implementation reference
Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗