node-escpos-windows

1.1.4 • Public • Published

npm i node-escpos-windows --build-from-source --runtime=electron --target=7.1.2 --target-arch=ia32 --dist-url=https://atom.io/download/electron

#escpos native plugin for electron FOSSA Status

#目前只支持 windows系统

// usb printer
const iconv = require('iconv-lite');

const escpos =require('node-escpos-windows');
const usblist = escpos.GetUsbDeviceList();
const printer = usblist.find(item => item.service ==='usbprint' || item.deviceName==='USB 打印支持');
const content = iconv.encode("你好啊\n halo cpp!\\n\n\n\n\nn\n\n\n\n", 'GB18030');
const {success, err} = escpos.PrintRaw(printer.path, content);
// lpt printer
const iconv = require('iconv-lite');
const escpos =require('node-escpos-windows');
const lptList = escpos.GetLptDeviceList();
const printer = lptList[0];
const content = iconv.encode("你好啊\n halo cpp!\\n\n\n\n\nn\n\n\n\n", 'GB18030');
const {success, err} = escpos.PrintRaw(printer.path, content);

// disconnect
const isDisConnected = escpos.Disconnect(printer.path);

License

FOSSA Status

Package Sidebar

Install

npm i node-escpos-windows

Weekly Downloads

1

Version

1.1.4

License

ISC

Unpacked Size

26.7 kB

Total Files

12

Last publish

Collaborators

  • fanduanduan