paystory-de / thermal-printer-cordova-plugin

Cordova wrapper for ESC/POS Thermal Printer library
Apache License 2.0
50 stars 39 forks source link

Change Charset Encoding #42

Closed christostsakalos closed 1 year ago

christostsakalos commented 1 year ago

Hi,

When I try to change charsetName from windows-1252 in ThermalPrinterCordovvaPlugin.java charsetEncoding = new EscPosCharsetEncoding( charsetEncodingData.optString("charsetName","CP737"),charsetEncodingData.optInt("charsetId", 16)); (same applies for every other charsetName, always returns windows-1252) The printer settings are setup to CP737 and are working properly when printing test-page. Running getEncoding still returns windows-1252

Any ideas whay might causing this?

arisSiozos commented 1 year ago

Hello Chris. Did you manage to solve this? I also need to use this plugin to print in Greek so i may need your help!

christostsakalos commented 1 year ago

Hi Aris,

Yes, All I did was i.e in printFormattedTextAndCut: printFormattedTextAndCut( { type: "tcp", mmFeedPaper: 150, address: #######, port: 9100, charsetEncoding: { charsetName: "CP737", charsetId: 12, }, id: ######, printerDpi: 203, printerWidthMM: 72, printerNbrCharactersPerLine: 40, },

Take a note that CP737 might also need configuration on the printer level as well depending on the model.

arisSiozos commented 1 year ago

Thanks for your response Chris! for my printer it was "WCP1253" and charsetId:45 (POS 80 printer).

sws-ylsoh commented 1 year ago

Hi @arisSiozos, how you get the charsetId?

arisSiozos commented 1 year ago

Hi @arisSiozos, how you get the charsetId?

By reading printer's manual. I think every printer has its own pair for charset names and Id's. In my case for most European languages the Id is 45.

sws-ylsoh commented 1 year ago

Hi @arisSiozos, how you get the charsetId?

By reading printer's manual. I think every printer has its own pair for charset names and Id's. In my case for most European languages the Id is 45.

Thanks for your reply. Too bad the printer manual doesn't have anything about the charsetId.

The model I am using is Imin POS D4. The printer is built-in and the documentation here .

Possible I can send some command or anyway to print the charset table?

arisSiozos commented 1 year ago

Sorry for taking too long to reply. I couldnt find anything for your printer sadly. Today i tried to print Greek with another printer(POS80C), whose manual had charsetId 45 for Greek letters, but i had to use charsetId:"15" in order to work (Makes no sense).

christostsakalos commented 1 year ago

I'm attaching this here https://github.com/DantSu/ESCPOS-ThermalPrinter-Android/issues/31 It's a list of charset ids