I think you can not without taking a dialog box for a security issue, (imagine that every time you entered a web page you printed the printer, lol). Anyway look at this that I found on the site in English, print it in string format:
This programmer has used this project link and this package of js
link .
link
I did an application like that .. I did it using link and
the module in the comment: link , here
is a working code with this module printing raw in the default printer
a file:
var printer = require('printer');
var fs = require('fs');
var info = fs.readFileSync('ticket.txt').toString();
function sendPrint() {
printer.printDirect({
data: info,
type: 'RAW',
success: function (jobID) {
console.log("ID: " + jobID);
},
error: function (err) {
console.log('printer module error: '+err);
throw err;
}
});
}
sendPrint();