2011-07-28 112 views
7

我有一個Epson TM-U220A,我寫和c#桌面應用程序打印收據。但它無法找到打印機。愛普生銷售點打印機 - 無法打印使用c#

打印機打印奇怪的字符,如果我通過記事本送東西(因此它的工作)

我有以下幾點:

  • POS對於.NET v1.12.exe
  • 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);

Set Up

+5

你知道是什麼行異常被拋出時? – ZombieSheep

+0

錯誤:端口名稱不合法,或者無法連接到設備。在線上:m_Printer.Claim(1000); –

+1

其中drfiver你使用opos或windows驅動程序? – TutuGeorge

回答

4

在我的經驗具有使用任何其他方式的打印機Windows打印機驅動程序安裝防止愛普生POS打印機工作。

我認爲你應該嘗試的第一件事是刪除打印機,在SetupPOS中再次設置它,然後再次嘗試你的程序。

祝你好運!

+0

這是按原樣...不知道爲什麼這會是問題。 – aggietech

0

打開了打印機的打印機端口嗎?這可能是這個問題..

我們需要以下端口開放和打印機啓用:

9100至9100與協議設置爲「兩者」 81至1800協議設置爲「兩者」

相關問題