chrome.printerProvider
- Description
The
chrome.printerProvider
API exposes events used by print manager to query printers controlled by extensions, to query their capabilities and to submit print jobs to these printers. - Permissions
printerProvider
Summary
- Types
- Events
Types
PrintJob
Properties
- contentTypestring
The document content type. Supported formats are
"application/pdf"
and"image/pwg-raster"
. - documentBlob
Blob containing the document data to print. Format must match |contentType|.
- printerIdstring
ID of the printer which should handle the job.
- ticketobject
Print ticket in CJT format.
- titlestring
The print job title.
PrinterInfo
Properties
- descriptionstring optional
Printer's human readable description.
- idstring
Unique printer ID.
- namestring
Printer's human readable name.
PrintError
Error codes returned in response to onPrintRequested
event.
Enum
"OK"
, "FAILED"
, "INVALID_TICKET"
, or "INVALID_DATA"
Events
onGetCapabilityRequested
chrome.printerProvider.onGetCapabilityRequested.addListener(listener: function)
Event fired when print manager requests printer capabilities.
Event
- listenerfunction
The listener parameter should be a function that looks like this:
(printerId: string, resultCallback: function) => {...}
- printerIdstring
Unique ID of the printer whose capabilities are requested.
- resultCallbackfunction
The resultCallback function looks like this:
resultCallback(capabilities: object) => {...}
- capabilitiesobject
onGetPrintersRequested
chrome.printerProvider.onGetPrintersRequested.addListener(listener: function)
Event fired when print manager requests printers provided by extensions.
Event
- listenerfunction
The listener parameter should be a function that looks like this:
(resultCallback: function) => {...}
- resultCallbackfunction
The resultCallback function looks like this:
resultCallback(printerInfo: PrinterInfo[]) => {...}
- printerInfo
onGetUsbPrinterInfoRequested
chrome.printerProvider.onGetUsbPrinterInfoRequested.addListener(listener: function)
Event fired when print manager requests information about a USB device that may be a printer.
Note: An application should not rely on this event being fired more than once per device. If a connected device is supported it should be returned in the onGetPrintersRequested
event.
Event
- listenerfunction
The listener parameter should be a function that looks like this:
(device: usb.Device, resultCallback: function) => {...}
- device
The USB device.
- resultCallbackfunction
The resultCallback function looks like this:
resultCallback(printerInfo: PrinterInfo) => {...}
- printerInfo
onPrintRequested
chrome.printerProvider.onPrintRequested.addListener(listener: function)
Event fired when print manager requests printing.
Event
- listenerfunction
The listener parameter should be a function that looks like this:
(printJob: PrintJob, resultCallback: function) => {...}
- printJob
The printing request parameters.
- resultCallbackfunction