c# – PrintNormal()问题’它没有初始化’
当前C#POS.NET打印问题:
PrintNormal()抛出异常=’它未初始化’ 使用POS for .NET 1.12和Epson OPOS ADK for .NET(v1.11.9)服务对象 在此之后向打印机发送任何内容 打印机使用直接并行打印精细 我们怎么能不把这个豁免 – “它没有被初始化”? void K8POSPrint() { /// <summary> /// PosPrinter object /// </summary> PosPrinter m_Printer = null; try { //Use a Logical Device Name which has been set on the SetupPOS. string strLogicalName = "PosPrinter"; try { //Create PosExplorer PosExplorer posExplorer = new PosExplorer(); DeviceInfo deviceInfo = null; try { // Device Info is not null when the printer has the logical name deviceInfo = posExplorer.GetDevice(DeviceType.PosPrinter,strLogicalName); m_Printer = (PosPrinter)posExplorer.CreateInstance(deviceInfo); } catch (Exception ExDevice) { } //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; // ////CheckHealth. //m_Printer.CheckHealth(Microsoft.PointOfService.HealthCheckLevel.Interactive); // //As using the PrintNormal method,send strings to a printer,and print it [n] is the standard code for starting a new line. /// Current Issue Next Line thows an exception - 'It is not initialized' m_Printer.PrintNormal(PrinterStation.Receipt,"Hey Now OPOS for .NETn"); // the next line would throw the exception 'The specified station is not mounted.' // m_Printer.PrintNormal(PrinterStation.Slip,"Hey Now Slip OPOS.NETn"); } catch (PosControlException) { } } catch (Exception ex) { } } 附加信息: ADK267ER4.exe https://www.epsonexpert.com/ee/appDev/appDevOPOS.htm OPOS_CCOs_1.13.001.msi http://monroecs.com/oposccos_current.htm 解决方法
问题可能不是软件,而是硬件.我看到了一个类似的问题(在
http://social.msdn.microsoft.com/Forums/vstudio/en-US/446fd4cc-db6b-4822-b3c8-7d9a98bf7eb4/it-is-not-initialized-when-trying-to-printnormal?forum=posfordotnet),开发人员使用的是不平行??的延长线.一旦他将并行电缆直接连接到打印机(没有延长电缆),他的软件就可以工作了.这是在他打电话给Epson并订购了一台更新的打印机之后,因为他们告诉他原来的打印机与.NET不兼容,所以这也可能是你的问题.
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |