7

I have an Epson TM-U220A, I am writing and c# desktop application to print receipt. But it is unable to find the printer.

The printer prints strange characters if i send something via notepad (thus its working)

I have the following:

  • POS for .Net v1.12.exe
  • OPOSN1.11.16 (Espon Wrapper for .net)
  • Espon driver installed
  • USB interface to the printer.

Code:

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

        }

Error: The port name is illegal, or couldn't be connected to the device. On line: m_Printer.Claim(1000);

Set Up

4

3 回答 3

4

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

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

祝你好运!

于 2011-08-09T06:37:15.943 回答
1

请检查 configuration.xml 文件。端口名称必须与 xml 中的相同,并且 SetupPOS 应该在串行端口中。

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

于 2013-11-18T10:35:55.987 回答
0

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

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

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

于 2013-05-08T17:40:05.897 回答