chrome.printing
| Description: |
Use the chrome.printing API to send print jobs to printers
installed on Chromebook.
|
| Availability: |
Since Chrome 81.
|
| Permissions: |
"printing"
|
Important: This API works only on Chrome OS.
Summary
| Properties | |
|---|---|
| MAX_SUBMIT_JOB_CALLS_PER_MINUTE | |
| MAX_GET_PRINTER_INFO_CALLS_PER_MINUTE | |
| Methods | |
submitJob −
chrome.printing.submitJob(object request, function callback)
| |
cancelJob −
chrome.printing.cancelJob(string jobId, function callback)
| |
getPrinters −
chrome.printing.getPrinters(function callback)
| |
getPrinterInfo −
chrome.printing.getPrinterInfo(string printerId, function callback)
| |
| Events | |
| onJobStatusChanged | |
Properties
20 |
chrome.printing.MAX_SUBMIT_JOB_CALLS_PER_MINUTE |
The maximum number of times that submitJob can be called per minute. |
20 |
chrome.printing.MAX_GET_PRINTER_INFO_CALLS_PER_MINUTE |
The maximum number of times that getPrinterInfo can be called per minute. |
Methods
submitJob
chrome.printing.submitJob(object request, function callback)
Submits the job for print. If the extension is not listed in PrintingAPIExtensionsWhitelist policy, the user will be prompted to accept the print job.
| Parameters | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| object | request |
|
|||||||||
| function | callback |
The callback parameter should be a function that looks like this: function(object response) {...};
|
|||||||||
cancelJob
chrome.printing.cancelJob(string jobId, function callback)
Cancels previously submitted job.
| Parameters | ||
|---|---|---|
| string | jobId |
The id of the print job to cancel. This should be the same id received in a SubmitJobResponse. |
| function | callback |
The callback parameter should be a function that looks like this: function() {...};
|
getPrinters
chrome.printing.getPrinters(function callback)
Returns the list of available printers on the device. This includes manually added, enterprise and discovered printers.
| Parameters | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| function | callback |
The callback parameter should be a function that looks like this: function(array of object printers) {...};
|
||||||||||||||||||||||||
getPrinterInfo
chrome.printing.getPrinterInfo(string printerId, function callback)
Returns the status and capabilities of the printer in CDD format. This call will fail with a runtime error if no printers with given id are installed.
| Parameters | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| string | printerId | ||||||||||
| function | callback |
The callback parameter should be a function that looks like this: function(object response) {...};
|
|||||||||
Events
onJobStatusChanged
Event fired when the status of the job is changed. This is only fired for the jobs created by this extension.
addListener
chrome.printing.onJobStatusChanged.addListener(function callback)
| Parameters | ||||||||
|---|---|---|---|---|---|---|---|---|
| function | callback |
The callback parameter should be a function that looks like this: function(string jobId, enum of
|
||||||