Created
July 19, 2017 14:17
-
-
Save kobkrit/88131ff8b036842d17d398a45e0f6528 to your computer and use it in GitHub Desktop.
Thermal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var thermal_printer = require(“node-thermal-printer”); | |
var printer = require(“printer”); | |
// console.log(printer.getPrinters()) | |
var star = printer.getPrinter(‘Star_TUP992__STR_T_U001_‘); | |
thermal_printer.init({ | |
type:‘star’ | |
}) | |
thermal_printer.println(“Hello World”); | |
thermal_printer.alignRight(); // Align text to right | |
thermal_printer.drawLine(); | |
console.log(printer.getPrinterDriverOptions(‘Star_TUP992__STR_T_U001_‘)) | |
printer.printDirect({ | |
data: thermal_printer.getBuffer(), | |
printer: star.name, | |
type: “TEXT”, | |
success: function(job_id){ | |
console.log(‘OK :‘+job_id); | |
}, | |
error: function(err){ | |
console.error(err); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment