Print Thai language

拥有回忆 提交于 2020-02-22 06:11:42

问题


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); 

I don't have any idea. Please help me. Would be a life savior.


回答1:


Here is the picture as I have described above in my comments. I have written a simple For..Next loop to print out the characters in the Thai codepage. From my picture I have highlighted the double char in the codepage and the char number of the Thai char.

Also, the third the printout shows the my code printing out Thai sentences with three lines for each Thai sentence. The first and third sentence has three lines.




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/53985095/print-thai-language

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!