ESC/POS Printer driver for Node.js
This is a fork of song940/node-escpos. It is partially rewritten to ES6 but currently it is not actively updated.
npm install @pokusew/escpos --save
If you use USBAdapter:
- On Linux, you'll need
libudevto build libusb.
- On Ubuntu/Debian:
sudo apt-get install build-essential libudev-dev.
- On Windows, Use Zadig to install the WinUSB driver for your USB device.
Otherwise you will get
LIBUSB_ERROR_NOT_SUPPORTED when attempting to open devices.
see example here
Prints raw text. Raises TextError exception.
Carrier feed and tabs.
align is a string which takes any of the following values:
- LF for Line Feed
- FF for Form Feed
- CR for Carriage Return
- HT for Horizontal Tab
- VT for Vertical Tab
Set text properties.
align set horizontal position for text, the possible values are:
font type could be A or B. Default: A width is a numeric value, 1 is for regular size, and 2 is twice the standard size. Default: 1 height is a numeric value, 1 is for regular size and 2 is twice the standard size. Default: 1
barcode("code", "barcode_type", width, height, "position", "font")
Prints a barcode.
code is an alphanumeric code to be printed as bar code barcode_type must be one of the following type of codes:
width is a numeric value in the range between (1,255) Default: 64 height is a numeric value in the range between (2,6) Default: 3 position is where to place the code around the bars, could be one of the following values:
font is one of the 2 type of fonts, values could be:
Raises BarcodeTypeError, BarcodeSizeError, BarcodeCodeError exceptions.
mode set a full or partial cut. Default: full Partial cut is not implemented in all printers.
Sends a pulse to the cash drawer in the specified pin.
pin is a numeric value which defines the pin to be used to send the pulse, it could be 2 or 5. Raises `CashDrawerError()``
- Part of code from @taoyuan