Amarnauth Persaud
Amarnauth Persaud

Reputation: 537

Epson Point of Sale Printer - Unable to print using c#

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:

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

Upvotes: 7

Views: 7411

Answers (3)

Sheela K R
Sheela K R

Reputation: 79

please Check the configuration.xml file. Port NAme must be same as in xml And SetupPOS that should be in serial Port.

For xml configuration Please check this link http://social.msdn.microsoft.com/Forums/en-US/5baad480-f2be-4cc9-94e0-572a3fa4697a/sharing-information-for-posnet-112-epson-tmt88v?forum=posfordotnet

Upvotes: 1

user2262275
user2262275

Reputation: 1

Did you open up the printer ports for the printer? That could be the problem..

We need the following ports open and enabled for the printer:

9100 to 9100 with Protocol set to "Both" 81 to 1800 with Protocol set to "Both"

Upvotes: 0

Daniel Dreier
Daniel Dreier

Reputation: 144

In my experience working with Epson POS printers having the Windows printer driver installed prevents using the printer in any other way.

I think the first thing you should try is deleting the printer, set it up again in SetupPOS, and try your program again.

Good luck!

Upvotes: 4

Related Questions