anastaciocintra / escpos-coffee

Java library for ESC/POS printer
https://anastaciocintra.github.io/escpos-coffee
MIT License
277 stars 72 forks source link

Printing Unicode characters #41

Closed crabtree81 closed 3 years ago

crabtree81 commented 4 years ago

Hi Marco, thanks for the neat and extremely useful library you've created.

Could you please help me with printing unicode characters? I need to print Traditional Chinese, encoded in Unicode (UTF-8) but can't get it working.

I understand that we can set the code page using the method: escpos.setCharacterCodeTable(CharacterCodeTable.xxx);

However, based on the API docs for Enum EscPos.CharacterCodeTable, there isn't a code page for Unicode.

I did see a "User_defined_page" value, but not sure how I to use this to apply Unicode.

Many thanks in advance. Cheers.

anastaciocintra commented 4 years ago

Hi @crabtree81
Thanks for the words about the project escpos coffee. I'm writing one wiki about this theme. In 2 or 3 days I'll put one complete answer. But in parallel y can read the similar issue #27 with same kind of problem. [], Marco

crabtree81 commented 4 years ago

Many thanks for the solution @anastaciocintra

After testing with the code derived from issue #27, i found i only need to call EscPos.setCharsetName("BIG5") but EscPos.setPrinterCharacterTable(x) was not needed.

I believe this is because my printers, Sewoo LK-TL122x series, are defaulted to BIG5 (i'm in Taiwan). Also, i don't believe it supports Unicode, but still waiting for manufacturer to confirm.

Thanks once again. Cheers.

anastaciocintra commented 4 years ago

good @crabtree81 , I have one doubt: did you printed your Chinese characters with writeLF or did you used another escpos set of commands?

It works with underline, bold, change sizes?

I'm curious, Its because my printer does not have Chinese character capabilities.

talk soon, Marco

crabtree81 commented 4 years ago

hi @anastaciocintra , i printed with the writeLF method... which is great!

I haven't tried the various styles though. i'm away next week but will try when i'm back in the office and let you know how i go.

thanks.

anastaciocintra commented 4 years ago

ok see you