chrome.printerProvider
- Description
The
chrome.printerProviderAPI 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 - AvailabilityChrome 44+
Summary
- Types
- Events
Types
PrinterInfo
Properties
- description
string optional
Printer's human readable description.
- id
string
Unique printer ID.
- name
string
Printer's human readable name.
PrintError
Error codes returned in response to onPrintRequested event.
Type
"OK"
,"FAILED"
,"INVALID_TICKET"
, or"INVALID_DATA"
PrintJob
Properties
- contentType
string
The document content type. Supported formats are
"application/pdf"and"image/pwg-raster". - document
Blob
Blob containing the document data to print. Format must match
contentType. - printerId
string
ID of the printer which should handle the job.
- ticket
object
Print ticket in CJT format.
- title
string
The print job title.
Events
onGetCapabilityRequested
chrome.printerProvider.onGetCapabilityRequested.addListener(
callback:
function,
)
Event fired when print manager requests printer capabilities.
Parameters
- callback
function
The
callbackparameter looks like:(printerId: string, resultCallback: function) => void- printerId
string
- resultCallback
function
The
resultCallbackparameter looks like:(capabilities: object) => void- capabilities
object
Device capabilities in CDD format.
onGetPrintersRequested
chrome.printerProvider.onGetPrintersRequested.addListener(
callback:
function,
)
Event fired when print manager requests printers provided by extensions.
Parameters
- callback
function
The
callbackparameter looks like:(resultCallback: function) => void- resultCallback
function
The
resultCallbackparameter looks like:(printerInfo: PrinterInfo[]) => void- printerInfo
onGetUsbPrinterInfoRequested
chrome.printerProvider.onGetUsbPrinterInfoRequested.addListener(
callback:
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.
Parameters
- callback
function
The
callbackparameter looks like:(device: usb.Device, resultCallback: function) => void- device
- resultCallback
function
The
resultCallbackparameter looks like:(printerInfo?: PrinterInfo) => void- printerInfo
PrinterInfo optional
onPrintRequested
chrome.printerProvider.onPrintRequested.addListener(
callback:
function,
)
Event fired when print manager requests printing.
Parameters
- callback
function
The
callbackparameter looks like:(printJob: PrintJob, resultCallback: function) => void- printJob
- resultCallback
function
The
resultCallbackparameter looks like:(result: PrintError) => void- result