I can able to print the text, Arabic characters but i am unable to print the formatted text like align center, bold text etc
I am using this plugin to print data https://github.com/don/BluetoothSerial
below are the commands for align center and bold text.
TXT_ALIGN_CT: '\x1b\x61\x01', // Centering
TXT_BOLD_ON: '\x1b\x45\x01';
followed below steps : 1.using below function to convert string to byte
private getPrintData(TEXT: string) {
// based on http://ciaranj.blogspot.fr/2007/11/utf8-characters-encoding-in-javascript.html
var bytes = [];
for (var n = 0; n < TEXT.length; n++) {
var c = TEXT.charCodeAt(n);
if (c < 128) {
bytes[bytes.length] = c;
} else if ((c > 127) && (c < 2048)) {
bytes[bytes.length] = (c >> 6) | 192;
bytes[bytes.length] = (c & 63) | 128;
} else {
bytes[bytes.length] = (c >> 12) | 224;
bytes[bytes.length] = ((c >> 6) & 63) | 128;
bytes[bytes.length] = (c & 63) | 128;
}
}
return bytes;
}
const printData = this.getPrintData(getPrintData('你好'));
this.printer.printData(printData ).then((success) => {});
its working fine.
2. try to pass ESC/POS commands as hex code like below.
const data = new Uint8Array([0x2fa00bf0e86c440658a6a71]);
this.printer.printData(data);
its not displaying bold text,
can any one please help me ??