ESC/POS命令打印汉字 [英] ESC/POS Command for Printing Chinese Character

查看:721
本文介绍了ESC/POS命令打印汉字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

打印机型号: Epson TM-T88V

Printer Model: Epson TM-T88V

ESC/POS命令指南(请参阅第115页): 我搜索了很多有关此功能的帖子,但仍然找不到正确打印中文的解决方案.下面是我到目前为止尝试过的代码(仍然显示乱码):

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.

推荐答案

查看本文 FS& ,似乎简化的中文支持因型号而异.
此外,即使支持型号,该设置也可能会更改默认值是否为简体中文模式.

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.

如果您的打印机支持简体中文,则可以在 FS.,即使默认不是简体中文模式也是如此.

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.

这篇关于ESC/POS命令打印汉字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆