Skip to content

examples/star_printer_index.js #423

@Elarabimo

Description

@Elarabimo

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions