Hi Team,
We are an existing customer of Dynamic PDF Print Manager.
Our system is currently on version 2.0.2.27188, we recently upgraded to version 4.6.0.39522.
After upgrading we are getting the following exception in the Event Viewer and application crashes abruptly.
"System.Runtime.InteropServices.COMException (0x80070006): The handle is invalid. (Exception from HRESULT: 0x80070006 (E_HANDLE))
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.FreeHGlobal(IntPtr hglobal)
at ceTe.DynamicPDF.Printing.PrintJob.Dispose(Boolean disposing)
at ceTe.DynamicPDF.Printing.PrintJob.Finalize()"
Please note this happens the second time we give the print request.
Please find the below piece of code we are using to call the Dynamic PDF PrintJob.
using (PrintJob printJob = new PrintJob(printerName, pdfFullFileName))
{
printJob.PrintOptions.Scaling = pageAutoPageScaling;
printJob.PrintOptions.Copies = numberOfCopies;
PrintJobPage page = null;
if (printJob.Pages != null)
page = printJob.Pages[0];
if (page != null && page.InputPdfPage.Width > page.InputPdfPage.Height)
{
printJob.PrintOptions.Orientation.Rotated = true;
}
printJob.Print();
}
The above piece of code runs in a thread.
The application crashes on printJob.Print().
Can you please let us know how to fix the above mentioned issue.