Unable to print PDFs

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF PrintManager for .NET (v2)  /  Re: Unable to print PDFs

DynamicPDF PrintManager for .NET (v2) Forum

 Jul 07 2014 12:32 PM
While trying to evaluate the software I discovered it isn't able to print any of the PDFs I am trying.  I keep getting the following message.

An error occurred while printing the document's pages.

I read the forum help here and it was indicated this error comes from insufficient permissions, i ran the app under elevated administrative permissions and got the same error.  Here are the exceptions.

Outer Exception

An error occurred while printing the document's pages.
   at ceTe.DynamicPDF.Printing.PrintJob.Print()

Inner Exception

Object reference not set to an instance of an object.
   at ceTe.DynamicPDF.Printing.PaperSize.b(d* )
   at ceTe.DynamicPDF.Printing.PrintJobPage.e()
   at ceTe.DynamicPDF.Printing.PrintJobPageList.a()
   at ceTe.DynamicPDF.Printing.PrintJob.Print()

 Jul 07 2014 5:05 PM
Posted by a ceTe Software moderator
Can you please send over the following details to support@cete.com so that we can look into it further?

1.        Code sample used for printing PDFs.
2.        Error message along with full stack trace.
3.        Are you printing to local or network printer?
4.        Operating system details: Name, x86 or x64.
5.        Printer name to which you are printing.
6.        Are you able to run code samples included with the evaluation download?

All this information will help us begin to pinpoint the potential cause of the issue.

Thanks,
ceTe Software support Team
 Jul 07 2014 5:28 PM
Here is the code nothing to complex or proprietary. the stack trace was already provided.  I am printing to a network printer named PrinterPool and a test printer call HP4300 x86.  When I run the sample code I get what appears to be the same error message.

public static bool printFile(byte[] report)
        {
            logEvent("Printing File", EventLogEntryType.Information);
            isPrinterOk(defaultPrinter);
            ceTe.DynamicPDF.Printing.PrintJob job = new ceTe.DynamicPDF.Printing.PrintJob(defaultPrinter, new ceTe.DynamicPDF.Printing.InputPdf(report));
            printStream(job);
            if(job.Status== ceTe.DynamicPDF.Printing.PrintJobStatus.Complete) {
                logEvent("File Printed", EventLogEntryType.SuccessAudit);
            } else {
                logEvent(string.Format("Print Failed : {0}",Enum.GetName(job.Status.GetType(), job.Status)), EventLogEntryType.FailureAudit);
            }
            return job.Status == ceTe.DynamicPDF.Printing.PrintJobStatus.Complete;
        }

        private static void printStream(ceTe.DynamicPDF.Printing.PrintJob job)
        {
            job.PrintOptions.PaperSource = getAutoSource(job);
/*
            job.Failed += new ceTe.DynamicPDF.Printing.PrintJobFailedEventHandler(job_Failed);
            job.Starting += new ceTe.DynamicPDF.Printing.PrintJobStartingEventHandler(job_Starting);
            job.Succeeded += new ceTe.DynamicPDF.Printing.PrintJobEventHandler(job_Succeeded);
            job.Updated += new ceTe.DynamicPDF.Printing.PrintJobEventHandler(job_Updated);
*/
            job.Print();
        }

        private static ceTe.DynamicPDF.Printing.PaperSource getAutoSource(ceTe.DynamicPDF.Printing.PrintJob job)
        {
            foreach (ceTe.DynamicPDF.Printing.PaperSource source in job.Printer.PaperSources)
            {
                if (source.Name.Trim().ToUpper().StartsWith("AUTO")) return source;
            }
            return null;
        }
 Jul 07 2014 5:47 PM
Here is the trace from the example app trying to print to a file.

C:\src\Visual Studio 2010_2012_2013\DynamicPDFPrintManager_CSharp\bin\Debug>Dyna
micPDFPrintManager_CSharp.exe

Unhandled Exception: ceTe.DynamicPDF.Printing.PrintFailedException: An error occ
urred while printing the document's pages. ---> System.NullReferenceException: O
bject reference not set to an instance of an object.
   at ceTe.DynamicPDF.Printing.PaperSize.b(d* )
   at ceTe.DynamicPDF.Printing.PrintJobPage.e()
   at ceTe.DynamicPDF.Printing.PrintJobPageList.a()
   at ceTe.DynamicPDF.Printing.PrintJob.Print()
   --- End of inner exception stack trace ---
   at ceTe.DynamicPDF.Printing.PrintJob.Print()
   at DynamicPDFPrintManager_CSharp.MaincClass.RedirectToFile() in C:\src\Visual
 Studio 2010_2012_2013\DynamicPDFPrintManager_CSharp\MaincClass.cs:line 146
   at DynamicPDFPrintManager_CSharp.MaincClass.Main(String[] args) in C:\src\Vis
ual Studio 2010_2012_2013\DynamicPDFPrintManager_CSharp\MaincClass.cs:line 25
 Jul 07 2014 6:08 PM
I also went ahead and rebooted still the same issue.  This is a process we are currently using Acrobat to fire from the command line but we would just like better control over the fire and forget method we have been using.
 Jul 09 2014 4:13 PM
After having the same issue with the foxit library we tried forcing the page size and everything printed as expected.  So apparently it isn't automatically setting the page size.
 Jul 15 2014 9:58 AM
Posted by a ceTe Software moderator
Hello,

We did some testing on our end on x86 machine by installing the HP Universal Printing PCL 6 drivers and we are unable to recreate the error while running the application with auto paper source selection mode settings. Normally it is not necessary to force the paper size, however it appears that the printer to which you are printing is not returning the paper size correctly when the paper source is set to auto.

Please try printing the PDFs to a printer (other than HP) without forcing the paper size and let us know the results.

Thanks,
ceTe Software Support Team.
 Mar 09 2017 3:31 AM
I am getting the same error. I am forcing the page size. But no luck.
 Mar 09 2017 1:01 PM
Posted by a ceTe Software moderator
Hello,

Can you please send over the following details to support@cete.com so we can look into further?

1.Are you getting error while printing a specific PDF? If so send over the source PDF.
2.Are you getting error while printing the PDF to a specific printer?
3.Try printing to some other printer and let us know the results.
4.Printer details on which you are getting error: Name, printer diver version.
5.Operating system details: Name, x86 or x64.
6.Code sample which uses static data to recreate the error.
7.Exact version and build number of the DynamicPDF PrintManager DLL file. You can get this information in DLL references properties (Version and Description fields) in Visual Studio.
8.Full error message along with stack trace.

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 1:36 AM.