manniru
3/17/2018 - 4:57 PM

raspberry_pi_pos_nodejs_WORKING.js

const escpos = require('escpos');
 
// Select the adapter based on your printer type
const device  = new escpos.USB();
// const device  = new escpos.Network('localhost');
// const device  = new escpos.Serial('/dev/usb/lp0');
 
const printer = new escpos.Printer(device);
 
device.open(function(){
  printer
  .font('a')
  .align('ct')
  .style('bu')
  .size(1, 1)
  .text('The quick brown fox jumps over the lazy dog')
  .text('敏捷的棕色狐狸跳过懒狗')
  .barcode('1234567', 'EAN8')
  .qrimage('https://github.com/song940/node-escpos', function(err){
    this.cut();
    this.close();
  });
});
const escpos = require('escpos');

const device  = new escpos.USB();
const printer = new escpos.Printer(device);

device.open(() => {
  printer
    .text('Hello World')
    .feed()
    .cut()
    .close(() => {
      console.log('Close')
    })
});
const escpos = require('escpos');

const device  = new escpos.USB();
const printer = new escpos.Printer(device);

device.open(() => {
  printer
    .text(' MANNIR ESYSTEMS NIGERIA LIMITED\n')
    .text('SOFTWARE & WEBSITE DEVELOPMENT COMPANY\n')
    .text('THIS IS TEST PRINT TO POS PRINTER FROM NODEJS RASPBERRY PI APPLICATION\n')
    .feed()
    .cut()
    .close(() => {
      console.log('Close')
    })
});