问题
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