-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIndex.js
25 lines (20 loc) · 934 Bytes
/
Index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
var express = require('express')
var app = express()
var printer = require("node-thermal-printer");
app.get('/', function(req,res){
printer.init({
type: 'star', // Printer type: 'star' or 'epson'
interface: '/dev/usb/lp0', // Printer interface
characterSet: 'SLOVENIA', // Printer character set
removeSpecialCharacters: false, // Removes special characters - default: false
replaceSpecialCharacters: true, // Replaces special characters listed in config files - default: true
});
printer.isPrinterConnected( function(isConnected){ console.log('Connected') } )
printer.execute( function(err){
printer.raw(new Buffer("Hello world"), function(err){
console.log(err);
});
});
res.send({"Sucess":true});
})
app.listen(3000, () => console.log('Example app listening on port 3000!'))