chrome.printerProvider
Description
chrome.printerProvider
API 公开打印管理器使用的事件,以查询由扩展控制的打印机、查询它们的功能并将打印作业提交给这些打印机。
Permissions
printerProvider
Availability
Chrome 44+
Summary
Types
Events
Types
PrinterInfo
PROPERTIES
description
string optional
打印机的人类可读描述。
id
string
唯一的打印机 ID。
name
string
打印机的人类可读名称。
PrintError
响应 onPrintRequested
事件返回的错误代码。
TYPE
"OK", "FAILED", "INVALID_TICKET", or "INVALID_DATA"
PrintJob
PROPERTIES
contentType
string
文档内容类型。支持的格式是
“application/pdf”
和“image/pwg-raster”
。document
Blob
包含要打印的文档数据的 Blob。格式必须与
contentType
匹配。printerId
string
应处理作业的打印机的 ID。
ticket
object
以 CJT format 打印票证。
title
string
打印作业标题。
Events
onGetCapabilityRequested
chrome.printerProvider.onGetCapabilityRequested.addListener(
callback: function,
)
当打印管理器请求打印机功能时触发的事件。
PARAMETERS
callback
function
The
callback
parameter looks like:(printerId: string, resultCallback: function) => void
printerId
string
resultCallback
function
The
resultCallback
parameter looks like:(capabilities: object) => void
capabilities
object
CDD format的设备功能。
onGetPrintersRequested
chrome.printerProvider.onGetPrintersRequested.addListener(
callback: function,
)
当打印管理器请求扩展提供的打印机时触发的事件。
PARAMETERS
callback
function
The
callback
parameter looks like:(resultCallback: function) => void
resultCallback
function
The
resultCallback
parameter looks like:(printerInfo: PrinterInfo[]) => void
printerInfo
onGetUsbPrinterInfoRequested
chrome.printerProvider.onGetUsbPrinterInfoRequested.addListener(
callback: function,
)
Chrome 45+
当打印管理器请求有关可能是打印机的 USB 设备的信息时触发的事件。
注意:应用程序不应依赖于每个设备多次触发此事件。如果支持连接的设备,则应在 onGetPrintersRequested
事件中返回它。
PARAMETERS
callback
function
The
callback
parameter looks like:(device: usb.Device, resultCallback: function) => void
device
resultCallback
function
The
resultCallback
parameter looks like:(printerInfo?: PrinterInfo) => void
printerInfo
PrinterInfo optional
onPrintRequested
chrome.printerProvider.onPrintRequested.addListener(
callback: function,
)
打印管理器请求打印时触发的事件。
PARAMETERS
callback
function
The
callback
parameter looks like:(printJob: PrintJob, resultCallback: function) => void
printJob
resultCallback
function
The
resultCallback
parameter looks like:(result: PrintError) => void
result
By.一粒技术服务.