gpt4 book ai didi

c# - PrintNormal() 问题 'It is not Initialized'

转载 作者:太空狗 更新时间:2023-10-29 20:42:19 27 4
gpt4 key购买 nike

当前的 C# POS.NET 打印问题:

PrintNormal() 抛出异常 = 'It is not initialized'
CheckHealth = '未初始化' 打印到 Epson TM-T88IV 时出现“未初始化”异常

使用 POS for .NET 1.12 和 Epson OPOS ADK for .NET (v1.11.9) 服务对象成功打开、声明和设置 PosPrinter 的 DeviceEnabled-true

问题在此之后向打印机发送任何内容PrintNormal() 导致抛出“未初始化”异常。Epson OPOS ADK 附带的 CheckHealth Utility 会导致完全相同的错误。使用 PrintNormal(PrinterStation.Receipt 时,异常是“未安装指定的站。”

打印机使用直接并行打印效果很好打印机本身打印

我们如何才能不抛出带有消息“它未初始化”的豁免?

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 .NET\n");
// the next line would throw the exception 'The specified station is not mounted.'
// m_Printer.PrintNormal(PrinterStation.Slip,"Hey Now Slip OPOS.NET\n");
}
catch (PosControlException)
{

}
}
catch (Exception ex)
{

}
}

附加信息: 尝试在 pos 打印机上打印时安装的程序是:
1.安装APD4打印机驱动Epson TI88IV
APD_412EWM.exe
https://www.epsonexpert.com/ee/techRes/index.htm?ProductId=570
在控制面板打印机中进行此设置后,我可以选择打印机的属性并成功打印到打印机的测试。
2.安装 Microsoft POS.NET 1.12
POSfor.NET.msi http://www.microsoft.com/downloads/en/details.aspx?FamilyID=eaae202a-0fcc-406a-8fde-35713d7841ca
3.安装爱普生 OPOS ADK v2.67
ADK267ER4.exe
https://www.epsonexpert.com/ee/appDev/appDevOPOS.htm
4.为 .NET 1.11.8 安装了 EPSON OPOS ADK
OPOSN 1 11 18.exe
https://www.epsonexpert.com/ee/appDev/appDevOPOS.htm
5.安装的 OPOS 公共(public)控制对象 1.13.001
OPOS_CCOs_1.13.001.msi
http://monroecs.com/oposccos_current.htm
6. SetupPOS - 添加的设备和逻辑名称
7. Check Health 仍然报错 它没有被初始化 OPOS_E_ILLEGAL 10007 (0x00002717)

最佳答案

问题可能不是软件,而是硬件。我看到了一个类似的问题(在 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 不兼容,所以这也可能是你的问题。

关于c# - PrintNormal() 问题 'It is not Initialized',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4000717/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com