Closed PimTournaye closed 2 years ago
Unfortunately I don't have a thermal printer at hand right now to test this out, but have you tried to encode your string with something like esc-pos-encoder?
I've used it before with some great success, but it was trial and error until I found the correct codepage.
I've set up a test func to go through every encoding in that module. Unfortunately, I still have issues, even after testing every encoding possible. Am I doing my Buffer stuff wrong? I know that using the esc-pos encoding makes my string into a UInt8Array but it still prints as weirdly as before. I'm kind of lost.
I'm not familiar with that printer (BIXOLON BK-31, right?), but I've found theses documents about the character codes it supports and how to set the character code to be used by the printer.
https://www.bixolon.com/_upload/manual/Manual_BK3-3_Command_english_Rev_1_01.pdf (Search for "Define user-defined character set") https://www.bixolon.com/_upload/manual/Manual_BK3-3_Code_Page_english_Rev_1_00.pdf
Other than that, I'm afraid I'm unable to help :(
I have been having issues printing accented characters and special characters. I've tried encoding the string as UTF-8 and passing that as a buffer in printDirect. I've tried using character sets on the printer itself.
Here is a testing string I use
' character test << >> … ÀÁÂÏȊ äæéẽëěęḙḛéêèçöṻ c'est « test » & @ ‼︎ ⁈ '
Here is what is being printed:
If anyone has any pointers, please feel free to share those.
Repo for context: https://github.com/PimTournaye/bixolon-printer/blob/master/printer.js