为什么“€"字样字符仅在打印机初始化之前打印,而不在初始化之后打印? [英] Why is the "€" character only printed before printer initialization and not after the initialization?

查看:144
本文介绍了为什么“€"字样字符仅在打印机初始化之前打印,而不在初始化之后打印?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一台Epson TM-T88VI打印机,并使用C#中的Microsoft.PointOfService.PosPrinter进行打印.

I have an Epson TM-T88VI printer and use the Microsoft.PointOfService.PosPrinter in C# for printing.

使用以下功能,我得到一个奇怪的输出:

Using the following function i get a strange output printed:

    public static void printerTestFunction2(string printerName)
    {
        PosExplorer explorer = new PosExplorer();
        DeviceInfo di = explorer.GetDevice("PosPrinter", printerName);
        PosPrinter printer = (PosPrinter)explorer.CreateInstance(di);

        printer.Open();
        printer.Claim(10000);
        printer.DeviceEnabled = true;
        printer.AsyncMode = false;

        string init = System.Text.ASCIIEncoding.ASCII.GetString(new byte[] { 27, 64 });
        string totalCut = System.Text.ASCIIEncoding.ASCII.GetString(new byte[] { 27, 105 });
        string cmd = init + init + "A€A\nB€B\n" + init + "C€C\nD€D\n\n\n\n\n\n\n" + totalCut;
        printer.PrintNormal(PrinterStation.Receipt, cmd);
    }

输出为:

A€A

B€B

CFC

DFD

因此,€符号被打印为一个奇怪的"F"符号(似乎F低于正常字符). 纸张已正确裁切.

So the € symbol is printed as a strange "F" symbol (seems like the F is lower than the normal characters). The paper is cut correctly.

我还测试了不同的星座.似乎€"符号仅在打印至少一行后发送给打印机的第一个init命令之前打印. (我可以在开头发送多个init命令-已打印€.如果在打印了一些字符后发送init,则将出现"F"而不是€"). 如果我重新启动程序,则再次正确打印€",但是如果我发送init命令,它将再次打印为"F".

I also have tested different constellations. It seems that the "€" sign is only printed before the first init command which is send to the printer after at least one row has been printed out. (I can send multiple init commands at the beginning - the € is printed. If i send the init after some chars have been printed, the "F" will appear instead of the "€"). If I restart my program, the "€" is again printed correctly, but if i send the init command it will be printed as "F" again.

仅在第三个init命令之前打印€"符号的原因是什么? 我的代码有什么问题吗?还是我错过了设置?

What is the reason that the "€" symbol is only printed before the third init command? Is there anything wrong with my code or do i miss a setting?

推荐答案

像F这样的字母被打印的原因是因为打印机处于初始化状态,代码页437.
请看以下材料中的字母,十进制为213,十六进制为0xD5.

The reason why letters like F are printed is because the printer is in the initialized state, code page 437.
Look at the letters in the following material at 213 in decimal and 0xD5 in hexadecimal.

第0页[PC437:美国,欧洲标准地区]

第19页[PC858:欧元]

POS for .NET服务对象根据CharacterSet属性的值在内部管理代码页设置.

The POS for.NET service object internally manages code page settings according to the value of CharacterSet property.

如果应用程序任意向打印机发送初始化命令,则服务对象的管理信息可能不一致,并且打印机可能打印不正确.

If the application arbitrarily sends initialization commands to the printer, the service object's management information may be inconsistent and the printer may print incorrectly.

如果您使用POS for.NET(包括OPOS/JavaPOS),则不应使用初始化命令(ESC @)或类似命令来更改模式或设置.

If you are using POS for.NET (including OPOS/JavaPOS), you should not use the initialization command (ESC@) or similar commands to change the mode or settings.

从这种意义上说,与其直接直接发送ESC i({27,105})剪纸,还不如调用CutPaper方法或将在UnifiedPOS中定义的POSPrinter剪纸转义序列(ESC | P)放入打印文件中.请求字符串.

In that sense, instead of sending the paper cut also directly the ESC i({ 27, 105 }) command, call the CutPaper method or put the POSPrinter paper cut escape sequence (ESC|P) defined in UnifiedPOS in the print request string.

这篇关于为什么“€"字样字符仅在打印机初始化之前打印,而不在初始化之后打印?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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