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.

PRINT_PREVIEW
The job was created from the Print Preview page initiated by the user.
ANDROID_APP
The job was created from an Android App.
EXTENSION
The job was created by extension via chrome API.
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.

FAILED
Print job was interrupted due to some error.
CANCELED
Print job was canceled by the user or via API.
PRINTED
Print job was printed without any errors.
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.

string name

Displayed name of the printer.

string uri

The full path for the printer. Contains protocol, hostname, port, and queue.

enum of "USER", or "POLICY" source

The source of the printer.

USER
Printer was added by user.
POLICY
Printer was added via policy.
object settings

The settings of the print job.

enum of "BLACK_AND_WHITE", or "COLOR" color

The requested color mode.

BLACK_AND_WHITE
Black and white mode was used.
COLOR
Color mode was used.
enum of "ONE_SIDED", "TWO_SIDED_LONG_EDGE", or "TWO_SIDED_SHORT_EDGE" duplex

The requested duplex mode.

ONE_SIDED
One-sided printing was used.
TWO_SIDED_LONG_EDGE
Two-sided printing was used, flipping on long edge.
TWO_SIDED_SHORT_EDGE
Two-sided printing was used, flipping on short edge.
object mediaSize

The requested media size.

integer width

Width (in micrometers) of the media used for printing.

integer height

Height (in micrometers) of the media used for printing.

string vendorId

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 .

integer copies

The requested number of copies.

integer numberOfPages

The number of pages in the document.

printing.PrinterStatus printer_status

Since Chrome 85. Warning: this is the current Beta 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) {...};
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) {...};
PrintJobInfo jobInfo