chrome.printingMetrics
| Description: |
Use the chrome.printingMetrics API to fetch data about
printing usage.
|
| Availability: |
Since Chrome 79.
|
| Permissions: |
"printingMetrics"
|
Important: This API works only on Chrome OS.
Summary
| Types | |
|---|---|
| PrintJobInfo | |
| Methods | |
getPrintJobs −
chrome.printingMetrics.getPrintJobs(function callback)
| |
| Events | |
| onPrintJobFinished | |
Types
PrintJobInfo
| properties | |||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| string | id |
The ID of the job. |
|||||||||||||||||||||
| string | title |
The title of the document which was printed. |
|||||||||||||||||||||
enum of "PRINT_PREVIEW", "ANDROID_APP", or "EXTENSION" |
source |
Source showing who initiated the print job.
|
|||||||||||||||||||||
| string | (optional) sourceId |
ID of source. Null if source is PRINT_PREVIEW or ANDROID_APP. |
|||||||||||||||||||||
enum of "FAILED", "CANCELED", or "PRINTED" |
status |
The final status of the job.
|
|||||||||||||||||||||
| double | creationTime |
The job creation time (in milliseconds past the Unix epoch). |
|||||||||||||||||||||
| double | completionTime |
The job completion time (in milliseconds past the Unix epoch). |
|||||||||||||||||||||
| object | printer |
The info about the printer which printed the document.
|
|||||||||||||||||||||
| object | settings |
The settings of the print job.
|
|||||||||||||||||||||
| integer | numberOfPages |
The number of pages in the document. |
|||||||||||||||||||||
| printing.PrinterStatus | printer_status |
Since Chrome 85. Warning: this is the current Dev channel. Learn more. The status of the printer. |
|||||||||||||||||||||
Methods
getPrintJobs
chrome.printingMetrics.getPrintJobs(function callback)
Returns the list of the finished print jobs.
| Parameters | |||||
|---|---|---|---|---|---|
| function | callback |
The callback parameter should be a function that looks like this: function(array of PrintJobInfo jobs) {...};
|
|||
Events
onPrintJobFinished
Event fired when the print job is finished. This includes any of termination statuses: FAILED, CANCELED and PRINTED.
addListener
chrome.printingMetrics.onPrintJobFinished.addListener(function callback)
| Parameters | |||||
|---|---|---|---|---|---|
| function | callback |
The callback parameter should be a function that looks like this: function( PrintJobInfo jobInfo) {...};
|
|||