【发布时间】:2013-04-08 16:43:55
【问题描述】:
下面是我的代码:
PosExplorer posExplorer = new PosExplorer();
DeviceCollection receiptPrinterDevices = posExplorer.GetDevices(DeviceType.PosPrinter);
DeviceInfo receiptPrinterDevice = posExplorer.GetDevice(DeviceType.PosPrinter,"SRP2");
PosPrinter printer = (PosPrinter)posExplorer.CreateInstance(receiptPrinterDevice);
printer.Open();
printer.Claim(10000);
printer.DeviceEnabled = true;
printer.PrintNormal(PrinterStation.Receipt, "test print 1");
我调试了,一切都毫无例外地进行了,已经确认目标打印机是正确的,但是打印机没有打印任何东西。有什么步骤我做错了吗?非常感谢任何指导。谢谢
如果有帮助,我的打印机接口通过以太网连接到特定 IP。
【问题讨论】:
-
Claimed的值是多少?致电printer.Claim(10000);后?并且您可以使用打印机随附的opos 设置程序(如果提供的话)打印到打印机吗? -
您可能还需要检查
receiptPrinterDevice.Description以确保 DeviceInfo 是您认为的那样。 -
您好,声称的值为“TRUE”,并且描述确认我得到了正确的打印机,而不是模拟器,有什么想法吗?谢谢..
-
通常打印机 OPOS 驱动程序附带一个设置实用程序,允许您设置逻辑名称(在您的情况下为
SRP2),如果是这样,请尝试从该实用程序发送测试打印。作为网络打印机,请确保您的防火墙没有阻止您的程序/端口,您可以尝试暂时禁用防火墙和防病毒软件,看看它是否在关闭它们的情况下打印。您的代码看起来不错,虽然receiptPrinterDevices似乎没有被使用。 -
是的,已经尝试从 Util 打印并且它可以工作,但不知何故仍然无法通过脚本打印任何内容..
标签: c# opos pos-for-.net