javascript – Problem with the printer in Node.js

I'm trying to run a txt against a printer with the intention of printing directly.

I use the node-printer library and although it does not generate error, the document remains indefinitely in the output bin and does not really get to the printer.

I do the tests with Windows 10 (which will be the production environment).

var printer = require ("printer");
filename = process.argv[2] || __file name;

console.log (& # 39; platform: & # 39 ;, process.platform);
console.log (default printer name: + (printer.getDefaultPrinterName () ||| is not set on your computer);
console.log (& # 39; s attempt to print the file: & # 39; + file name);

if (process.platform! = & # 39; win32 & # 39;) {
printer.printFile ({filename: filename,
printer: printer.getDefaultPrinterName (),
success: function (jobID) {
console.log ("sent to the printer with ID:" + jobID);
}
error: function (err) {
console.log (err);
}
});

} else {
var fs = require (& # 39; fs & # 39;);
printer.printDirect ({
data: fs.readFileSync (filename) .toString (),
printer: printer.getDefaultPrinterName (),
type: "RAW",
success: function (jobID) {
console.log ("sent to the printer with ID:" + jobID);
}
error: function (err) {
console.log (err);
}
});

Of course, I have tested the printer and it works by printing from other sources.