在 Epson TM-T88IVM 上打印简体汉字
我正在尝试使用 C# 中的 Microsoft 服务点 SDK 在 Epson TM-T88IV M(并行端口)上打印中文字符。但是,它们在打印机上显示为问号。 (?)
我的 PosPrinter 具有以下有效的 CharacterSetList : 255,437,850,852,858,860,863,865,866,936,998,999,1252
以及以下 CapCharacterSet: Kanji
代码页 1252 是默认的 Windows 代码页。 936 是简体中文的代码页。在本例中,我使用代码页 936,但始终无法在打印机上显示汉字。
示例:
string str = "重新开始";
// open device as variable _ReceiptPrinter, claim it, mark it as enabled
_ReceiptPrinter.CharacterSet = 936;
_ReceiptPrinter.PrintNormal(PrinterStation.Receipt, str);
打印出所有汉字都替换为“?”的文本。
我不确定在打印之前是否需要指定额外的转义码(ESC R 15?),或者我的打印机在 Epson OPOS (v2.50e) 中是否配置错误。我尝试了很多方法,但没有任何效果。有什么想法或代码示例吗?
注意:打印机自检时确实打印汉字。
I am trying to print Chinese characters on an Epson TM-T88IV M (parallel port) using the Microsoft Point of Service SDK in C#. However, they appear as questions marks on the printer. (?)
My PosPrinter has the following valid CharacterSetList :
255,437,850,852,858,860,863,865,866,936,998,999,1252
And the following CapCharacterSet: Kanji
Code page 1252 is the default windows code page. 936 is the code page for simplified Chinese. In this case, I am using code page 936 but have never been able to display Chinese characters on the printer.
Example:
string str = "重新开始";
// open device as variable _ReceiptPrinter, claim it, mark it as enabled
_ReceiptPrinter.CharacterSet = 936;
_ReceiptPrinter.PrintNormal(PrinterStation.Receipt, str);
This prints out the text with all Chinese characters replaced with ?.
I am not sure if I need to specify additional escape codes before printing (ESC R 15?) or if my printer is misconfigured in Epson OPOS (v2.50e). I tried a number of things, but nothing has worked. Any ideas or code examples?
Note: in its self test, the printer does print Chinese characters.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Epson TM-T88IV Multilingual 要求您将字符串转换为 CodePage 936,然后用 ISO-8859-1 表示该字符串。
有关算法的详细信息,请参阅另一个问题:
我们可以简化这个字符串编码吗代码
在发送到打印机之前执行此操作。
str = Encoding.GetEncoding("ISO-8859-1").GetString(Encoding.GetEncoding(_ReceiptPrinter.CharacterSet).GetBytes(str));
The Epson TM-T88IV Multilingual requires that you convert the string into CodePage 936 and then represent that string in ISO-8859-1.
See this other question for details on the algorithm:
Can we simplify this string encoding code
do this before sending to printer.
str = Encoding.GetEncoding("ISO-8859-1").GetString(Encoding.GetEncoding(_ReceiptPrinter.CharacterSet).GetBytes(str));