我正在尝试使用C#中的Microsoft Point of Service SDK在Epson TM-T88IV M(并行端口)上打印中文字符。但是,它们在打印机上显示为问号。(?)
我的PosPrinter具有以下有效的CharacterSetList : 255,437,850,852,858,860,863,865,866,936,998,999,1252
和下面的CapCharacterSet:汉字
代码页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)中配置错误。我尝试了很多方法,但都不起作用。有什么想法或代码示例吗?
注:在自检中,打印机可以打印中文字符。
发布于 2010-01-16 00:36:34
爱普生TM-T88IV多语言要求您将字符串转换为ISO936,然后以CodePage -8859-1表示该字符串。
有关算法的详细信息,请参阅另一个问题:
Can we simplify this string encoding code
在发送到打印机之前执行此操作。字符串= Encoding.GetEncoding("ISO-8859-1").GetString(Encoding.GetEncoding(_ReceiptPrinter.CharacterSet).GetBytes(str));
https://stackoverflow.com/questions/1941988
复制相似问题