我有一个TM-T20爱普生,我用这段代码试图打印:"Hello“消息,我一直在跟踪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");
}一切都进行得很好,我检查了它是否是正确的打印机,并且打开了它,但当我试图声明它时,我有以下例外:
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.即使在示例应用程序 (C:\Program \\SDK\Sample\Sample应用程序)文件夹(C:\Program\Microsoft\SDK\Samples)中提供的Microsoft 中,我也可以找到打印机,打开它,但是当我声明它时,我收到了以下错误消息:
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.示例应用程序的打印屏幕:

发布于 2019-07-26 13:17:42
这个错误是因为您的端口配置不好。
在我的例子中,我使用了连接到硬件NPort 5110的FP-81 II模型,在那里我将端口配置为9100。

我希望能帮你。
https://stackoverflow.com/questions/22430995
复制相似问题