PrintNormal() Issue 'It is not Initialized'
Current C# POS.NET Printing Issue:
PrintNormal()
Throws Exception = 'It is not initialized'
CheckHealth
= 'It is not initialized'
'It is not initialized' exception when Printing to Epson TM-T88IV
Using POS for .NET 1.12 and the Epson OPOS ADK for .NET (v1.11.9) service-objects Successfully able to Open, Claim and Set the DeviceEnabled-true for PosPrinter
Issue sending anything to the printer after this PrintNormal() results in a 'It is not initialized' exception being thrown. CheckHealth Utility that came with the Epson OPOS ADK results in exactly the same error. When using PrintNormal(PrinterStation.Receipt the exception is 'The specified station is not mounted."
printer prints fine using direct parallel printer itself prints
How can we not throw the exemption with the message - 'It is not initialized'?
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, 开发者_如何学Pythonand 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)
{
}
}
Additional Information: Programs installed while attempting to print on the pos printer are:
1. Installed APD4 Printer Driver Epson TI88IV APD_412EWM.exe https://www.epsonexpert.com/ee/techRes/index.htm?ProductId=570 After this set in control panel printers I can select the printer's properties & print a test to the printer successfully. 2. Installed Microsoft POS.NET 1.12 POSfor.NET.msi http://www.microsoft.com/downloads/en/details.aspx?FamilyID=eaae202a-0fcc-406a-8fde-35713d7841ca 3. Installed Epson OPOS ADK v2.67 ADK267ER4.exe https://www.epsonexpert.com/ee/appDev/appDevOPOS.htm 4. Installed EPSON OPOS ADK for .NET 1.11.8 OPOSN 1 11 18.exe https://www.epsonexpert.com/ee/appDev/appDevOPOS.htm 5. Installed OPOS Common Control Objects 1.13.001 OPOS_CCOs_1.13.001.msi http://monroecs.com/oposccos_current.htm 6. SetupPOS - Added device & Logical Name 7. Check Health still throws the errors It is not initialized OPOS_E_ILLEGAL 10007 (0x00002717)The problem might not be software, but hardware. I saw a similar question (at http://social.msdn.microsoft.com/Forums/vstudio/en-US/446fd4cc-db6b-4822-b3c8-7d9a98bf7eb4/it-is-not-initialized-when-trying-to-printnormal?forum=posfordotnet), where the developer was using an extension cable which was not parallel. As soon as he connected the parallel cable directly to the printer (without the extension cable), his software worked. This was after he called Epson and ordered a newer printer, because they told him his original printer was not compatible with .NET, so that could also be your problem.
I had the same error "It is not initialized" on brand new Epson TM-T88VI. The printer came with IDN Card and default the ethernet card was partially blocked. You can use the ethernet card to connect to "Epson Net Config", but it did not work when you try to print by OPOS ADK for NET. The solution was to set switches on IDN Card as:
DS1 | DS2 | DS3 | DS4 | DS5 | DS6 | DS7 |
---|---|---|---|---|---|---|
OFF | OFF | OFF | OFF | ON | ON | ON |
Make sure Power OFF when you changing the switches.
精彩评论