Printing on bluetooth printers

Sorry but i am trying to figure that one myself also.

1 Like

Sir !
Thanks very much, I can’t print Thai word…, such as “ ไทยแลน ”,
how to fix it ?
Thanks you.

There was a similar issue opened quite awhile ago, and this is the recommended solution for Chinese characters. I am not sure, but this could work for Thai character as well?

thanks your response.

my ionic code:

public printText(text, charset = ‘UTF-8’){
alert(text);
let encodedWord = iconv.encode(‘謝謝’, ‘EUC-CN’);
window.DatecsPrinter.printText(encodedWord, charset, function (success) {
alert(JSON.stringify(success));
}, function (error) {
alert(“error”);
});
}

Hi razmans!
I’m trying to convert numbers in barcode when printing, do you have some example?

this is my code:
let data = ‘My barcode:’ + ‘\x1d\x48\x01’ + ‘111114123457’;
this.bluetoothSerial.write(data).then(data => {
console.log(data);
});
}

It’s possible? or generate QRcode when printint too? thanks!

Sorry, but I have not done QR Code and barcode printing. If you have a solution, please do share

Sorry for the late response. I’m not sure how to print in Chinese characters, maybe you can contact the person that opened the issue on how he/she manage to resolve this.

Its possible to print images?
do you have some example my friend? thank you!

Sorry for the late response. It is possible to pront bitmaps, but i am not sure how to do it

My solution works only with bluetooth receipt printers. For other printer, i would recommend using an ionic native print plugin. It could assist you with your problems

okay, thank you my friend, God bless you!

May be this link can help.

@razmans Can we print pdf using plugin? Do you have any idea about printing pdf or html directly ? Can you give some idea on this? Thanks in advance.

Try this:

Hello @razmans,Thanks for the response. For now, this is what i am doing. But this leads me to the print preview page. But what i need to know is how can i connect to bluetooth printer and print a pdf file in printer directly? Can you share some idea about how to do that. Thanks again!

@vishwas097 did you get any solution?

@Sayakion Hey yes! I am using https://github.com/don/BluetoothSerial plugin to list bluetooth printer,connect to printer and write data to printer.

This was working with ionic 3 perfectly:

import {MutableBuffer} from 'mutable-buffer';

buff=new MutableBuffer()

but with Ionic 4 i get error:

buff=new MutableBuffer(); // now it expects 2 arguments but gets 0, and shows error

Even if i try to add arguments like this:

buff = new MutableBuffer(1024, 1024);

i get error:

ERROR Error: Uncaught (in promise): ReferenceError: Buffer is not defined
ReferenceError: Buffer is not defined

Anyone had same problem?