Good night, I'm new here, I hope not to commit any infractions and be of help, I tell them that I'm dealing with the impression in Node.js, the need is to create a software in node.js and run it directly on the computer where I will have connected 3 printers (we will call them a, b and c), according to the requirement will print in 'a' or in 'b' or in 'c', the problem is that I have tried with a module called escpos, where it tells me that I must use a program named Zadig to print on windows, well I do it that way but it generates an error that the printer can not find, I do not know if I should put something in the program folder or something like that, the code I have is:
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')
})
});
this is the error that generates
also use one that was advised here, called node-printer, but also tells me that you can not find the printer
this is the code:
var Printer = require('node-printer');
var options = {
media: 'Custom.200x600mm',
n: 3
};
// Get available printers list
Printer.list();
// Create a new Pinter from available devices
var printer = new Printer('TM-T88V');
// Print from a buffer, file path or text
var fileBuffer = fs.readFileSync('/path/to/file.ext');
var jobFromBuffer = printer.printBuffer(fileBuffer);
var filePath = 'package.json';
var jobFromFile = printer.printFile(filePath);
var text = 'Print text directly, when needed: e.g. barcode printers'
var jobFromText = printer.printText(text);
// Cancel a job
jobFromFile.cancel();
// Listen events from job
jobFromBuffer.once('sent', function() {
jobFromBuffer.on('completed', function() {
console.log('Job ' + jobFromBuffer.identifier + 'has been printed');
jobFromBuffer.removeAllListeners();
});
});
Thank you very much in advance for your collaboration, many greetings