Unhandled Exception

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF PrintManager for .NET (v1)  /  Re: Unhandled Exception

DynamicPDF PrintManager for .NET (v1) Forum

 Jul 29 2013 4:23 PM
I have been able to get the print manager to work well for the most part, but have come across an error that I can figure out how to handle correctly.  Here is a code snippet: http://pastebin.com/FaapFSXk

Basically I am calling RunWorkerAsync to print my document.  I get an exception that gets caught in bw_DoWork: Print job could not be created in the spooler. Error code:1722

There is also an unhandled exception that is not caught that causes my application to crash:
pplication: PrintService.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: ceTe.DynamicPDF.Printing.PrintingException
Stack:
   at k.d()
   at System.Threading.ThreadHelper.ThreadStart_Context(System.Object)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.ThreadHelper.ThreadStart()

I would have expected this to get caught in the PrintJobFailed event, but it did not.

Here are my questions:  Where does that error code come from?  Is it a DynamicPDF error code or from Windows?  How can I handle the exception that I assume is happening withing the DynamicPDF library in an asynchronous process?

Thanks.
 Jul 30 2013 10:35 AM
Posted by a ceTe Software moderator
Hello,

Is this error happening when a specific document is printed? If this is the case please email the PDF to support@cete.com

What is the version & build number of the PrintManager dll you are currently using?

Thanks,
ceTe Software Support Team.
 Jul 30 2013 12:22 PM
The error is not with a specific document, but with a specific printer.  I have tried different documents with the same error.  It is a network printer.  I am less concerned with why the error is happening ( I think it has to do with permissions for the printer).  I really just want to know how I can be sure to handle an exception like that if it occurs.  The problem is when it happens it crashes the service and it must be restarted manually.


ceTe.DynamicPDF.Printing.40.x86.dll
DLL Version: 1.0.1.20321
 Aug 01 2013 10:38 AM
Posted by a ceTe Software moderator
Hello,

Thanks for the info, we are looking into it and will post an update soon.

Thanks,
ceTe Software Support Team.
 Sep 03 2013 4:56 PM
Posted by a ceTe Software moderator
Hello,

This issue has been fixed in the latest version of PrintManager. Please email our support team at support@cete.com to obtain the new build.

Thanks,
ceTe Software Support Team.
 Oct 30 2013 8:20 PM
We started getting this error yesterday and have gotten it many times since with different pdf's. Can you offer any insight?
 Oct 31 2013 12:32 PM
Posted by a ceTe Software moderator
Hello,

The latest build of PrintManager that contains the fix as per our last post was released on the website. If you are still evaluating, an evaluation edition can be downloaded here. If you have a license to use the latest version you can login to the customer area and download it there.

If you are already using the latest build and still seeing the error, please email us at support@cete.com with the following information.

1. Exception message including stack trace.
2. Code used.
3. Printer details

Thanks,
ceTe Software Support Team.
 Jun 27 2018 6:10 AM
I have a below dll reference in my .net solution[windows service] to print pdf to remote printer.

I noticed some weird issue with this dll. When printing a document to printer, service is getting crashed and need to restart it manually. No exceptions being recorded or caught.

It’s happening only with particular printer not the document. When passed the same document to anther network printer, its printing fine.

Please advise with this issue, let me know if you need any further details on this. Thanks in advance.

ceTe.DynamicPDF.Printing.20.x64.dll

file version: 1.0.1.18760
Product Version: 1.0.1.18760
 Jun 29 2018 12:05 PM
Posted by a ceTe Software moderator
Hello,

Please try using the latest DynamicPDF PrintManager for .NET product DLL file in your application and see if it works for you. You can download latest DynamicPDF PrintManager for .NET product installer from our website here. Install the latest product , remove reference for the older DLL file and reference the latest DLL file in your application.

Thanks,
ceTe Software Support Team.
 Jul 23 2018 6:19 PM
Try with the latest dll file, the issue still remains.

I have created one .net framework console application and referenced the below version of dll [after you suggested ].

ceTe.DynamicPDF.Printing.40.x64.dll
file version: 3.0.1.35763
Product Version: 3.0.1.35763

Below is the sample code that I used to replicate the issue and Console application gets freeze at printJob.Print();  this statement.
It won't close or step into next statement. We need to restart the job\console application.

Its not happening with particular document or printer. We have multiple such printers on the Server we access remotely as \\servername\printername .

We use printspooler on the print server.

            string strConvertedFile = "File Path";
            string PrinterName = "\\\\ServerName\IP\\PrinterName";

            try
            {

                PrintJob printJob = new PrintJob(PrinterName);
                printJob.Pages.Add(strConvertedFile);
                printJob.PrintOptions.Scaling = new AutoPageScaling();
                printJob.PrintOptions.Copies = int.Parse("1");
                printJob.Print(); // Job stuck here, don't go to next statement

                printJob.Dispose(); //debugger not hitting here, job still shows running but nothing happens.
            }
            catch (Exception ex)
            {
               //debugger not hitting here if any exceptions
            }

Regards,
Bhaskar Reddy.
 Jul 25 2018 1:19 PM
Posted by a ceTe Software moderator
Hello,

We looked into the code sample you posted. You are using wrong printer name (which includes IP address) to access the network printer. The DynamicPDF PrintManager product does not supports accessing printers using IP address. Please try using the correct printer name and see if it work for you.

Use the below syntax for the network printer name.
string printername = @"\\ServerName\Printer name";

Thanks,
ceTe Software Support Team.
 Jul 29 2018 5:03 PM
HI Team,

Thanks for your response,

We usually get the printer name from Database table.

printer name is mentioned as "\\ServerName\PrinteName " in the database table and same is being fetched into Datatable [c#] and assigned to local variable.

I will try your suggestion in my sample code and see if it catches the exception.

Regards,
Bhaskar Reddy.
 Oct 15 2019 11:53 AM
Hi All,
I am getting the below error. Any suggestions are highly appreciated.

 System.Threading.SynchronizationLockException: Object synchronization method was called from an unsynchronized block of code.
    at v.a(String )
  at ceTe.DynamicPDF.Printing.PrintJob..ctor(String printerName, String pdfFileName)
    at Manh.ILS.Reporting.BL.PdfPrintRequestProcessor.PrintWithDynamicPDFManager(String printerName, String pdfFullFileName, Int32 numberOfCopies, Boolean& isPrinted, Session session)
 Oct 15 2019 12:34 PM
Posted by a ceTe Software moderator
Hello,

Can you please let us know the exact version and build number of the DynamicPDF PrintManager DLL file used in the application? You can get this information in DLL references properties (Version and Description fields) in Visual Studio.

Thanks,
ceTe Software Support Team

All times are US Eastern Standard time. The time now is 6:06 AM.