ESC/POS Command for Printing Chinese Character

牧云@^-^@ 提交于 2020-01-06 05:30:08

问题


Printer Model: Epson TM-T88V

ESC/POS Command Guide (look at P.115): http://download.delfi.com/SupportDL/Epson/Manuals/TM-T88IV/Programming%20manual%20APG_1005_receipt.pdf

I've searched so many posts about this funcionality but still can't find a solution to print Chinese properly. Below is the code I've tried so far (still prints garbles text):

Socket socket = new Socket("192.168.1.111", 9100);                          //one socket responsible for one device

PrintWriter printWriter = new PrintWriter(socket.getOutputStream());        //create a PrintWriter object

printWriter.println("HI,test from Android Device");
printWriter.println("");                                                    //empty line

printWriter.println(new char[]{0x1B, 0x52, 0x15});                          //codepage for simplified chinese, see the P.115 in the guide above
printWriter.println("中".getBytes("GB2312"));                               //character encoding stuff? Not sure how it works
printWriter.println("\n\n");

printWriter.println(new char[]{0x1D, 0x56, 0x41, 0x10});                    //"0x1d, 0x56, 0x41" is for paper cut and "0x10" is for line feed
printWriter.close();

socket.close();

Anyone can help? Thank you very much.


回答1:


Looking at this article FS &, it seems that Simplified Chinese support is different depending on the model number.
In addition, even if the model number is supported, the setting may change whether the default is Simplified Chinese mode.

Check with your dealer or vendor to see if your printer has a model that supports Simplified Chinese.
And check if the default is Simplified Chinese mode.

If your printer supports Simplified Chinese, you will be able to switch between FS & and FS., even if the default is not Simplified Chinese mode.



来源:https://stackoverflow.com/questions/58881605/esc-pos-command-for-printing-chinese-character

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