Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples/star_printer_index.js #423

Open
Elarabimo opened this issue May 18, 2023 · 0 comments
Open

examples/star_printer_index.js #423

Elarabimo opened this issue May 18, 2023 · 0 comments

Comments

@Elarabimo
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant