title: Epson Point of Sale Printer - Unable to print using c#
body: <p>I have an Epson TM-U220A, I am writing and c# desktop application to print receipt. But it is unable to find the printer.</p>
  
  <p>The printer prints strange characters if i send something via notepad (thus its working)</p>
  
  <p>I have the following:</p>
  
  <ul>
  <li>POS for .Net v1.12.exe </li>
  <li>OPOSN1.11.16 (Espon Wrapper for .net)</li>
  <li>Espon driver installed</li>
  <li>USB interface to the printer.</li>
  </ul>
  
  <p>Code:</p>
  
  <pre><code>private void FormLoad(object sender, System.EventArgs e)
          {
  
              //&lt;&lt;&lt;step1&gt;&gt;&gt;--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();
              }
              //&lt;&lt;&lt;step1&gt;&gt;&gt;--End
  
          }
  </code></pre>
  
  <p>Error: The port name is illegal, or couldn't be connected to the device.
  On line: m_Printer.Claim(1000);</p>
  
  <p><img src="https://i.stack.imgur.com/6KAQN.png" alt="Set Up"></p>