Namespace: qz

qz

Source:

Namespaces

api
configs
hid
printers
security
serial
usb
websocket

Members

(static, constant) version :string

Version of this JavaScript library
Type:
  • string
Source:

Methods

(static) print(config, data, signatureopt, signingTimestampopt) → {Promise.<(null|Error)>}

Send data to selected config for printing. The promise for this method will resolve when the document has been sent to the printer. Actual printing may not be complete.

Optionally, print requests can be pre-signed: Signed content consists of a JSON object string containing no spacing, following the format of the "call" and "params" keys in the API call, with the addition of a "timestamp" key in milliseconds ex. '{"call":"","params":{...},"timestamp":1450000000}'

Parameters:
Name Type Attributes Description
config Object.<Config> Previously created config object.
data Array.<(Object|string)> Array of data being sent to the printer. String values are interpreted the same as the default [raw] object value.
Properties
Name Type Attributes Description
data string
type string Valid values [html | image | pdf | raw]
format string <optional>
Format of data provided.

For [html] types, valid formats include [file(default) | plain].

For [image] types, valid formats include [base64 | file(default)].

For [pdf] types, valid format include [base64 | file(default)].

For [raw] types, valid formats include [base64 | file | hex | plain(default) | image | xml].

options Object <optional>
Properties
Name Type Attributes Description
language string <optional>
Required with [raw] type [image] format. Printer language.
x number <optional>
Optional with [raw] type [image] format. The X position of the image.
y number <optional>
Optional with [raw] type [image] format. The Y position of the image.
dotDensity string | number <optional>
Optional with [raw] type [image] format.
xmlTag string <optional>
Required with [xml] format. Tag name containing base64 formatted data.
pageWidth number <optional>
Optional with [html] type printing. Width of the web page to render. Defaults to paper width.
pageHeight number <optional>
Optional with [html] type printing. Height of the web page to render. Defaults to adjusted web page height.
signature boolean <optional>
Pre-signed signature of JSON string containing call, params, and timestamp.
signingTimestamp number <optional>
Required with signature. Timestamp used with pre-signed content.
Source:
See:
  • qz.config.create
Returns:
Type
Promise.<(null|Error)>