Description
Use the chrome.printingMetrics API to fetch data about printing usage.
Permissions
printingMetricsAvailability
Types
ColorMode
Enum
"BLACK_AND_WHITE"  "COLOR" 
 Specifies that black and white mode was used.
 Specifies that color mode was used.
DuplexMode
Enum
"ONE_SIDED"  "TWO_SIDED_LONG_EDGE"  "TWO_SIDED_SHORT_EDGE" 
 Specifies that one-sided printing was used.
 Specifies that two-sided printing was used, flipping on long edge.
 Specifies that two-sided printing was used, flipping on short edge.
MediaSize
Properties
- 
    heightnumber Height (in micrometers) of the media used for printing. 
- 
    vendorIdstring Vendor-provided ID, e.g. "iso_a3_297x420mm" or "na_index-3x5_3x5in". Possible values are values of "media" IPP attribute and can be found on IANA page . 
- 
    widthnumber Width (in micrometers) of the media used for printing. 
Printer
Properties
- 
    namestring Displayed name of the printer. 
- 
    sourceThe source of the printer. 
- 
    uristring The full path for the printer. Contains protocol, hostname, port, and queue. 
PrinterSource
The source of the printer.
Enum
"USER"  "POLICY" 
 Specifies that the printer was added by user.
 Specifies that the printer was added via policy.
PrintJobInfo
Properties
- 
    completionTimenumber The job completion time (in milliseconds past the Unix epoch). 
- 
    creationTimenumber The job creation time (in milliseconds past the Unix epoch). 
- 
    idstring The ID of the job. 
- 
    numberOfPagesnumber The number of pages in the document. 
- 
    printerThe info about the printer which printed the document. 
- 
    printer_statusChrome 85+The status of the printer. 
- 
    settingsThe settings of the print job. 
- 
    sourceSource showing who initiated the print job. 
- 
    sourceIdstring optional ID of source. Null if source is PRINT_PREVIEW or ANDROID_APP. 
- 
    statusThe final status of the job. 
- 
    titlestring The title of the document which was printed. 
PrintJobSource
The source of the print job.
Enum
"PRINT_PREVIEW"  "ANDROID_APP"  "EXTENSION"  "ISOLATED_WEB_APP" 
 Specifies that the job was created from the Print Preview page initiated by the user.
 Specifies that the job was created from an Android App.
 Specifies that the job was created by extension via Chrome API.
 Specifies that the job was created by an Isolated Web App via API.
PrintJobStatus
Specifies the final status of the print job.
Enum
"FAILED"  "CANCELED"  "PRINTED" 
 Specifies that the print job was interrupted due to some error.
 Specifies that the print job was canceled by the user or via API.
 Specifies that the print job was printed without any errors.
PrintSettings
Properties
- 
    colorThe requested color mode. 
- 
    copiesnumber The requested number of copies. 
- 
    duplexThe requested duplex mode. 
- 
    mediaSizeThe requested media size. 
Methods
getPrintJobs()
chrome.printingMetrics.getPrintJobs(
callback?: function,
): Promise<PrintJobInfo[]>
Returns the list of the finished print jobs.
Parameters
- 
    callbackfunction optional The callbackparameter looks like:(jobs: PrintJobInfo[]) => void - 
    jobs
 
- 
    
Returns
- 
            Promise<PrintJobInfo[]> Chrome 96+Promises are only supported for Manifest V3 and later, other platforms need to use callbacks. 
Events
onPrintJobFinished
chrome.printingMetrics.onPrintJobFinished.addListener(
callback: function,
)
Event fired when the print job is finished. This includes any of termination statuses: FAILED, CANCELED and PRINTED.
Parameters
- 
    callbackfunction The callbackparameter looks like:(jobInfo: PrintJobInfo) => void - 
    jobInfo
 
-