Skip to content

Commit

Permalink
Added upsideDown() function for rotating all content 180 degrees.
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinbolton committed Aug 10, 2016
1 parent f734222 commit 3b53ea0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ printer.openCashDrawer(); // Kick the cash draw
printer.cut(); // Cuts the paper (if printer only supports one mode use this)
printer.partialCut(); // Cuts the paper leaving a small bridge in middle (if printer supports multiple cut modes)
printer.beep(); // Sound internal beeper/buzzer (if available)
printer.upsideDown(true); // Content is printed upside down (rotated 180 degrees)

printer.bold(true); // Set text bold
printer.invert(true); // Background/text color inversion
Expand Down
2 changes: 2 additions & 0 deletions configs/epsonConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ module.exports = {
HW_SELECT : new Buffer([0x1b, 0x3d, 0x01]), // Printer select
HW_RESET : new Buffer([0x1b, 0x3f, 0x0a, 0x00]), // Reset printer hardware
BEEP : new Buffer([0x1b, 0x1e]), // Sounds built-in buzzer (if equipped)
UPSIDE_DOWN_ON : new Buffer([0x1b,0x7b,0x01]), // Upside down printing ON (rotated 180 degrees).
UPSIDE_DOWN_OFF : new Buffer([0x1b,0x7b,0x00]), // Upside down printing OFF (default).

// Cash Drawer
CD_KICK_2 : new Buffer([0x1b, 0x70, 0x00]), // Sends a pulse to pin 2 []
Expand Down
9 changes: 9 additions & 0 deletions node-thermal-printer.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,15 @@ module.exports = {
else append(config.TXT_UNDERL_OFF);
},

upsideDown: function(enabled){
if (printerConfig.type == 'star'){
console.error("Upside down not supported on STAR yet");
return;
}
if(enabled) append(config.UPSIDE_DOWN_ON);
else append(config.UPSIDE_DOWN_OFF);
},

invert: function(enabled){
if (printerConfig.type == 'star'){
console.error("Invert not supported on STAR yet");
Expand Down

0 comments on commit 3b53ea0

Please sign in to comment.