react-native-thermal-receipt-printer
Advanced tools
Comparing version 1.2.0-rc.1 to 1.2.0-rc.2
@@ -29,2 +29,10 @@ import { Buffer } from "buffer"; | ||
var line_bytes = Buffer.from([10, 10, 10, 10, 10]); | ||
var encoding_mappings_bytes = { | ||
// single byte encodings | ||
"CP437": Buffer.from([27, 116, 0]), | ||
// multiple bit encodings | ||
"GB18030": Buffer.from([28, 38, 28, 67, 0]), | ||
"BIG5": Buffer.from([28, 38, 28, 67, 1]), | ||
"UTF8": Buffer.from([28, 38, 28, 67, 255]), | ||
}; | ||
var options_controller = { | ||
@@ -34,2 +42,3 @@ cut: cut_bytes, | ||
tailingLine: line_bytes, | ||
encoding: encoding_mappings_bytes, | ||
}; | ||
@@ -66,2 +75,6 @@ var controller = { | ||
bytes.concat(init_printer_bytes); | ||
// set encoding | ||
if (m_options["encoding"] && options_controller["encoding"][m_options["encoding"]]) { | ||
bytes.concat(options_controller["encoding"][m_options["encoding"]]); | ||
} | ||
bytes.concat(default_space_bytes); | ||
@@ -95,6 +108,2 @@ var temp = ""; | ||
temp.length && bytes.concat(iconv.encode(temp, m_options.encoding)); | ||
// check for "encoding" flag | ||
if (typeof m_options["encoding"] === "boolean" && options_controller["encoding"]) { | ||
bytes.concat(options_controller["encoding"]); | ||
} | ||
// check for "tailingLine" flag | ||
@@ -101,0 +110,0 @@ if (typeof m_options["tailingLine"] === "boolean" && options_controller["tailingLine"]) { |
{ | ||
"name": "react-native-thermal-receipt-printer", | ||
"version": "1.2.0-rc.1", | ||
"version": "1.2.0-rc.2", | ||
"description": "Fork of react-native-printer. A React Native Library to support USB/BLE/Net printer", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -189,7 +189,7 @@ # react-native-thermal-receipt-printer | ||
printTextTest = () => { | ||
currentPrinter && USBPrinter.printText("<C>sample text</C>\n"); | ||
currentPrinter && BLEPrinter.printText("<C>sample text</C>\n"); | ||
} | ||
printBillTest = () => { | ||
currentPrinter && USBPrinter.printBill("<C>sample bill</C>"); | ||
currentPrinter && BLEPrinter.printBill("<C>sample bill</C>"); | ||
} | ||
@@ -196,0 +196,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
6242614
66
466