node-escpos icon indicating copy to clipboard operation
node-escpos copied to clipboard

examples/star_printer_index.js

Open Elarabimo opened this issue 1 year ago • 0 comments

examples/star_printer_index.js

async printReceipt() { const escpos = require('escpos'); escpos.Network = require('escpos-network'); const device = new escpos.Network('192.168.1.48',9100); const printer = new escpos.Printer(device);

  device.open(function () {
    printer
        .font('a')
        .align("STAR_CA")
        .style('bu')
        .size(1, 1)
        .emphasize()
        .text('The quick brown fox jumps over the lazy dog')
        .cancelEmphasize()
        .align("STAR_LA")
        .text('Hello, am printing')
        .align("STAR_RA")
        .barcode('1234567', 'EAN8')
        .qrimage('https://github.com/song940/node-escpos', function () {
          this.fullCut()
          this.close();
        });
  });
},

am getting this error.. "TypeError: net.Socket is not a constructor" I read everywhere that via browser I should just forget the TCP support.. is that true? is there any work around to be able to print via ethernet cable? if yes what to do?

Otherwise I think I can go with the usb solution witch I dont prefer.. any help please?

Elarabimo avatar May 18 '23 07:05 Elarabimo