I have an application which print the receipt to receipt printer using ESC/POS. It needs to support Thai language.
When I tried to print Thai language, some of the characters are being separated like this photo:
Here is my code:
printMSG = Command.ESC + "t" + Command.DecimalToCharString(27);
port.Write(printMSG);
var enc = Encoding.GetEncoding("windows-874");
string content = "ข้าวผัดอินโดนีเซียกับเครื่องเทศแบบดั้ง";
byte[] bytes = enc.GetBytes(content);
port.Write(bytes, 0, bytes.Length);
Thai language is called a three-pass language. Which means print the top line, middle line and bottom line separately.
For example รื่ has top and middle characters, you must print them on each lines, from your picture these are printed at bottom, hence as top line.
For another example ดั้, has double top characters, you need to look up the character in the code page.
There are others bottom characters, these will be printed at top hence as bottom line.
Do some testing, you will get it.
Printing with Command mode would required the support from hardware (in my case Star Micronics). I ran into the same problem and could only solve it by rasterizing the whole content into Bitmap then print the whole Bitmap.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With