【问题标题】:Epson Point of Sale Printer - Unable to print using c#爱普生销售点打印机 - 无法使用 c# 打印
【发布时间】:2011-10-15 01:29:36
【问题描述】:

我有一个 Epson TM-U220A,我正在编写和 c# 桌面应用程序来打印收据。但是找不到打印机。

如果我通过记事本发送某些东西,打印机会打印出奇怪的字符(因此可以正常工作)

我有以下几点:

  • .Net v1.12.exe 的 POS
  • OPOSN1.11.16(Espon Wrapper for .net)
  • Espon 驱动已安装
  • 打印机的 USB 接口。

代码:

private void FormLoad(object sender, System.EventArgs e)
        {

            //<<<step1>>>--Start
            //Use a Logical Device Name which has been set on the SetupPOS.
            string strLogicalName = "PosPrinter";
           // string strLogicalName = "ESDPRT001";

            try
            {
                //Create PosExplorer
                PosExplorer posExplorer = new PosExplorer();

                DeviceInfo deviceInfo = null;

                try
                {
                    deviceInfo = posExplorer.GetDevice(DeviceType.PosPrinter, strLogicalName);
                    m_Printer = (PosPrinter)posExplorer.CreateInstance(deviceInfo);
                }
                catch (Exception)
                {
                    ChangeButtonStatus();
                    return;
                }

                //Open the device
                m_Printer.Open();

                //Get the exclusive control right for the opened device.
                //Then the device is disable from other application.
                m_Printer.Claim(1000);

                //Enable the device.
                m_Printer.DeviceEnabled = true;
            }
            catch (PosControlException)
            {
                ChangeButtonStatus();
            }
            //<<<step1>>>--End

        }

错误:端口名称非法,或无法连接到设备。 在线:m_Printer.Claim(1000);

【问题讨论】:

  • 你知道异常是在哪一行抛出的吗?
  • 错误:端口名称不合法,或无法连接到设备。在线:m_Printer.Claim(1000);
  • 你在使用opos或windows驱动是哪个drfiver?

标签: c# printing epson pos-for-.net


【解决方案1】:

根据我使用安装了 Windows 打印机驱动程序的 Epson POS 打印机的经验,可以防止以任何其他方式使用打印机。

我认为您应该首先尝试删除打印机,在 SetupPOS 中重新设置,然后再次尝试您的程序。

祝你好运!

【讨论】:

  • 按原样工作......不知道为什么会出现这个问题。
【解决方案2】:

您是否打开了打印机的打印机端口?这可能是问题..

我们需要为打印机打开并启用以下端口:

9100 到 9100,协议设置为“两者” 81 到 1800,协议设置为“两者”

【讨论】:

    【解决方案3】:

    请检查 configuration.xml 文件。 Port NAme 必须与 xml 中的相同,并且 SetupPOS 应该在 serial Port 中。

    xml配置请查看此链接 http://social.msdn.microsoft.com/Forums/en-US/5baad480-f2be-4cc9-94e0-572a3fa4697a/sharing-information-for-posnet-112-epson-tmt88v?forum=posfordotnet

    【讨论】:

      猜你喜欢
      • 2015-10-25
      • 2015-04-04
      • 2013-02-25
      • 2013-01-26
      • 2010-10-10
      • 2016-05-06
      • 2013-10-19
      • 2014-12-13
      • 1970-01-01
      相关资源
      最近更新 更多