Open qaoo8 opened 4 years ago
To print in Chinese, try this:
First set the text encoding to GB2312 or the corresponding chinese encoding supported by your printer:
var strEncoding = "GB2312"; /* official character set of the People's Republic of China */
BTPrinter.setEncoding(function (data) {
console.log(data);
}, function (err) {
console.error(err);
}, strEncoding);
Second, send an ESC t command to set the character code table according your printer:
var hexCharCodePOS = "1B74??"; /* where ?? is the character code table in HEX */
BTPrinter.printPOSCommand(function (data) {
console.log("Success");
}, function (err) {
console.error(err);
}, hexCharCodePOS);
Refer to your printer's character code tables for the Chinese code. EPSON codes can be found here.
Remember to set the character code table in HEX, so to select Page 47 [WPC1253: Greek]
you should send 47
in hexadecimal:
hexCharCodePOS = "1B742F"; /* (ESC t in HEX => 1B74) + (WCP1253 => EPSON page 47 => 2F in HEX) */
Try the BTPrinter Plugin Demo app to test your printer with any language.
I have a project need to print the Chinese Character, according to your source file below, could you let us know how to enable it? Thank you!
boolean printText(CallbackContext callbackContext, String msg) throws IOException {