Namespace: qz

qz

Source:

Namespaces

api
configs
file
hid
networking
printers
security
serial
usb
websocket

Members

(static, constant) version :string

Version of this JavaScript library
Type:
  • string
Source:

Methods

(static) print(configs, data, …argumentsopt) → {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
configs Object.<Config> | Array.<Object.<Config>> Previously created config object or objects.
data Array.<(Object|string)> | Array.<Array.<(Object|string)>> Array of data being sent to the printer.
String values are interpreted as {type: 'raw', format: 'command', flavor: 'plain', data: <string>}.
Properties
Name Type Attributes Default Description
data string
type string Printing type. Valid types are [pixel | raw*]. *Default
format string Format of data type used. *Default per type

For [pixel] types, valid formats are [html | image* | pdf].

For [raw] types, valid formats are [command* | html | image | pdf].

flavor string Flavor of data format used. *Default per format

For [command] formats, valid flavors are [base64 | file | hex | plain* | xml].

For [html] formats, valid flavors are [file* | plain].

For [image] formats, valid flavors are [base64 | file*].

For [pdf] formats, valid flavors are [base64 | file*].

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.
precision number <optional>
128 Optional with [raw] type [image] format. Bit precision of the ribbons.
options.overlay boolean | string | Array.<Array.<number>> <optional>
false Optional with [raw] type [image] format. Boolean sets entire layer, string sets mask image, Array sets array of rectangles in format [x1,y1,x2,y2].
options.xmlTag string <optional>
Required with [xml] flavor. Tag name containing base64 formatted data.
options.pageWidth number <optional>
Optional with [html | pdf] formats. Width of the rendering. Defaults to paper width.
options.pageHeight number <optional>
Optional with [html | pdf] formats. Height of the rendering. Defaults to paper height for [pdf], or auto sized for [html].
arguments * <optional>
<repeatable>
Additionally three more parameters can be specified:

{boolean} [resumeOnError=false] Whether the chain should continue printing if it hits an error on one the the prints.

{string|Array} [signature] Pre-signed signature(s) of the JSON string for containing call, params, and timestamp.

{number|Array} [signingTimestamps] Required to match with signature. Timestamps for each of the passed pre-signed content.

Source:
See:
Returns:
Type
Promise.<(null|Error)>