加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Epson销售点打印机 – 无法使用c#打印

发布时间:2020-12-15 07:43:51 所属栏目:百科 来源:网络整理
导读:我有一台Epson TM-U220A,我正在编写和c#桌面应用程序来打印收据.但它无法找到打印机. 如果我通过记事本发送东西(因此它的工作),打印机打印奇怪的字符 我有以下内容: POS for .Net v1.12.exe OPOSN1.11.16(针对.net的Espon Wrapper) 安装了Espon驱动程序 打
我有一台Epson TM-U220A,我正在编写和c#桌面应用程序来打印收据.但它无法找到打印机.

如果我通过记事本发送东西(因此它的工作),打印机打印奇怪的字符

我有以下内容:

> POS for .Net v1.12.exe
> OPOSN1.11.16(针对.net的Espon Wrapper)
>安装了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);

解决方法

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

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

祝好运!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读