Skip to content

Print

Printing to connected printers

Kind: global namespace

print.printLabelImage(image)

Print a 300 DPI image on the shipping label printer, centered on a 4x6 inch label. Image is automatically scaled to 200 DPI if required by the printer.

Kind: static method of print

Param Type Description
image ArrayBuffer | Buffer | Uint8Array | string | Jimp image data, as a Jimp image object, raw PNG bytes, or a URL (http/https) string. 1200x1800 or 800x1200 images are scaled to 4x6 inches. Other image sizes are assumed to be 300 DPI and are centered on the shipping label. Image orientation is rotated to match the label orientation.

print.getReceiptPrinter() ⇒ Promise.<Object>

Get the receipt printer interface. See the ReceiptPrinter docs for available functions.

Kind: static method of print

print.printReceiptData(data)

Send raw data (generated by the printer interface) to the receipt printer.

Kind: static method of print

Param Type Description
data string | Uint8Array | Array.<string> | Array.<Uint8Array> Data to send to printer.

print.imageToBitmap(jimpImage, [dpiFrom], [dpiTo]) ⇒ Object

Convert a Jimp image object to 1-bit monochrome image data before sending image data to a printer interface. Optionally scales the image to a different DPI before conversion.

Kind: static method of print
Returns: Object - - Example: {width: 300, height: 200, img: Uint8Array}. Pass img to drawImage on a printer interface.

Param Type Default Description
jimpImage Jimp
[dpiFrom] number 300 Original image DPI.
[dpiTo] number 300 New image DPI.