4

I have a TM-T20 Epson, I'm using this code to try to print : "Hello Printer" Message, and i keep tracking of some proprieties of the PosPrinter :

public void ImprintHelloPrinter()
        {
            //The Explorer
            PosExplorer explorer = new PosExplorer();

            ////Get the device by its type LOGICAL NAME
            DeviceInfo device = explorer.GetDevice(DeviceType.PosPrinter, "T20PRINTER");

            //Create an instance
            PosPrinter oposPrinter = (PosPrinter)explorer.CreateInstance(device);

            //Opening 
            MessageBox.Show(@"Statue : " + oposPrinter.State.ToString());
            oposPrinter.Open();
            MessageBox.Show(@"Statue : " + oposPrinter.State.ToString());

            //Checking if its really the printer
            MessageBox.Show(@"Description : " + oposPrinter.DeviceDescription);


            MessageBox.Show(@"Check Claimed : " + oposPrinter.Claimed.ToString());
            oposPrinter.Claim(10000); //Here is My Exception 

            //Enabeling device
            oposPrinter.DeviceEnabled = true;

            //normal print
            oposPrinter.PrintNormal(PrinterStation.Receipt, "Hello Printer");
        }

Everything went OK, i checked that it is the right Printer and it opened and its not claimed, but when i try to Claim it i have the following Exception :

Method ClaimDevice threw an exception.  Attempt was made to perform an illegal 

or unsupported operation with the device, or an invalid parameter value was used.

Even in the Example application provided with the Microsoft Point Of Service SDK in the Sample Application Folder (C:\Program Files\Microsoft Point Of Service\SDK\Samples\Sample Application), i can find my printer, open it, but when i Claim it i have this error message :

POSControlException ErrorCode(Illegal) ExtendedErrorCode(10002) occurred:
Method ClaimDevice threw an exception.  Attempt was made to perform an illegal
 or unsupported operation with the device, or an invalid parameter value was 
used.

Print Screen Of The Sample Application :

enter image description here

Kirk Woll
  • 76,112
  • 22
  • 180
  • 195
KADEM Mohammed
  • 1,650
  • 2
  • 23
  • 45
  • oposPrinter.Claim(10000); //Here is My Exception – KADEM Mohammed Mar 15 '14 at 23:25
  • I've had some odd results using POS for .Net if I had a printer driver already installed for the printer/port. Do you have something like a generic/text only driver installed? Maybe try removing it if you do. Also, re-installing the opos drivers for your specific printer is always a good idea if nothing else works. – Josh Anderson Mar 15 '14 at 23:35
  • So you are confirming that my problem is a configuration problem ! and not in my CODE !!! and i have another computer, i will try to install again and configure and ill tell you the results. and could you please clarify what do you mean by **generic/text only driver installed** what is that ? – KADEM Mohammed Mar 16 '14 at 00:38
  • 1
    You can install a printer in windows as a "generic/text only" kind of printer, which is a common thing to do with receipt printers. Your code looks fine, plus it's failing in the POS for .Net application. – Josh Anderson Mar 16 '14 at 01:04
  • i struggling with it without result :/ i even installed a new Win Seven in another computer, still same problem : Everything goes well till the Claim(); it gives me an error !!!! any help ? – KADEM Mohammed Mar 20 '14 at 21:12
  • Your code looks ok, it's pretty much in line with what I've got in the application I've been working on...my next question would be along the lines of which driver did you install for it? Did you install the OPOS driver for the printer? Or just the standard Windows driver? – Fooksie Mar 21 '14 at 04:37
  • @CarterNolan i am having same issue, did you solved this issue? – sandeepKumar Aug 12 '16 at 17:14
  • same problem with Citizen CT-S2000... – Yuriy Nov 10 '17 at 13:34

1 Answers1

0

The error is because you have bad port configurated.
In my case, I use model FP-81 II connected to hardware NPort 5110 where I was configure port to 9100.

NPort configuration

I hope help you.

Vitaly
  • 21
  • 5