无法声明PosPrinter [英] can't claim the PosPrinter

查看:78
本文介绍了无法声明PosPrinter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个TM-T20 Epson,我正在使用以下代码尝试打印:"Hello Printer"消息,并且我一直在跟踪PosPrinter的某些特性:

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.

即使在示例应用程序文件夹中, Microsoft Point of Service SDK 提供的示例应用程序( C:\ ProgramFiles \ Microsoft Point of Service \ SDK \ Samples \ Sample Application ),我可以找到我的打印机,将其打开,但是当我声明它时,出现以下错误消息:

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.

示例应用程序的打印屏幕:

推荐答案

错误是因为配置的端口错误.
就我而言,我使用的是连接到硬件NPort 5110的FP-81 II型,其中我将端口配置为9100.

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.

希望对您有所帮助.

这篇关于无法声明PosPrinter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆