I am trying to use escpos, and escpos-usb in my nodejs project to print receipt. I always get the error usb.on is not a function when i try to start the my server.js file. Is there any alternative in doing this using Epson TM-T20III printer, or if there’s a solution to help me fix this
var escpos = require("escpos");
var USB = require("escpos-usb");
const device = new USB();
var printer = new escpos.Printer(device);
const printReceipt = () => {
device.open(() => {
printer
.font("a")
.align("CT")
.style("bu")
.size(1, 1)
.text("This is a test print")
.cut()
.close();
});
};
module.exports = {
printReceipt: printReceipt,
};
New contributor
Joshua is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.