forked from lsongdev/node-escpos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implements multiple printers for the USB adapter, updates readme to e…
…xplain how to use it
- Loading branch information
Showing
4 changed files
with
168 additions
and
23 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
const escpos = require('../'); | ||
|
||
const device = new escpos.USB(); | ||
const printer = new escpos.Printer(device); | ||
|
||
device.openAll(function(){ | ||
let devices = device.getDevices(); | ||
|
||
for(let i = 0; i < devices; i++) { | ||
console.log('Printing on device', (i+1)); | ||
setTimeout(function() { | ||
device.setDevice(i); | ||
printer.font('a') | ||
.align('ct') | ||
.style('bu') | ||
.size(1, 1) | ||
.text('This is the printer #' + (i+1)) | ||
.cut(); | ||
}, 500*i); | ||
} | ||
|
||
}); |
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