欢迎 What's new in Chrome extensions Get help with Chrome extensions API reference Samples
欢迎 What's new in Chrome extensions Get help with Chrome extensions API reference Samples

chrome.printingMetrics

  • Description

    Use the chrome.printingMetrics API to fetch data about printing usage.

  • Permissions
    printingMetrics
  • Availability
    Chrome 79+

Summary

Types

ColorMode

Type

"BLACK_AND_WHITE"

, or

"COLOR"

DuplexMode

Type

"ONE_SIDED"

,

"TWO_SIDED_LONG_EDGE"

,
or

"TWO_SIDED_SHORT_EDGE"

MediaSize

Properties

  • height

    number

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

  • vendorId

    string

    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 .

  • width

    number

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

Printer

Properties

  • name

    string

    Displayed name of the printer.

  • The source of the printer.

  • uri

    string

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

PrinterSource

The source of the printer.

Type

"USER"

, or

"POLICY"

PrintJobInfo

Properties

  • completionTime

    number

    The job completion time (in milliseconds past the Unix epoch).

  • creationTime

    number

    The job creation time (in milliseconds past the Unix epoch).

  • id

    string

    The ID of the job.

  • numberOfPages

    number

    The number of pages in the document.

  • printer

    The info about the printer which printed the document.

  • printer_status
    Chrome 85+

    The status of the printer.

  • The settings of the print job.

  • Source showing who initiated the print job.

  • sourceId

    string optional

    ID of source. Null if source is PRINT_PREVIEW or ANDROID_APP.

  • The final status of the job.

  • title

    string

    The title of the document which was printed.

PrintJobSource

The source of the print job.

Type

"PRINT_PREVIEW"

,

"ANDROID_APP"

,
or

"EXTENSION"

PrintJobStatus

The final status of the print job.

Type

"FAILED"

,

"CANCELED"

,
or

"PRINTED"

PrintSettings

Properties

  • The requested color mode.

  • copies

    number

    The requested number of copies.

  • The requested duplex mode.

  • mediaSize

    The requested media size.

Methods

getPrintJobs

chrome.printingMetrics.getPrintJobs(
  callback?: function,
)
Promise

Returns the list of the finished print jobs.

Parameters

Returns

  • Promise<PrintJobInfo[]>

    Chrome 96+

    Promises are supported in Manifest V3 and later, but callbacks are provided for backward compatibility. You cannot use both on the same function call. The promise resolves with the same type that is passed to the callback.

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

We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.