views:

23

answers:

1

Hey Now Everybody-

Current C# POS.NET 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'?

Thx 4 your help in advance,

Catto

       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)
            {

            }

        }
+1  A: 

Can you post your stack trace?

Grand Master T
What is the signature for the PrintNormal() method?
Grand Master T
Thanks for your assistance Grand Mater T StackTrace " at jp.co.epson.upos.pntr.CommonPrinterService.ExecuteNormalPrint(Int32 iStationIndex, String strData, Boolean bTransaction, Boolean bFlow, Boolean bImmediate)\r\n at jp.co.epson.upos.pntr.CommonPrinterService.PrintNormal(PrinterStation station, String strData)\r\n at jp.co.epson.upos.pntr.T88IVService.PrintNormal(PrinterStation station, String strData)\r\n at Barcode.Option1.mtPOSPrint() in C:\\Documents and Settings\\ccatto\\My Documents\\Visual Studio 2008\\Projects\\Barcode\\Option1.xaml.cs:line 275" string
Catto
void PosPrinter.PrintNormal(PrinterStation station, string data)
Catto