2 Replies Latest reply on Feb 14, 2008 7:40 AM by rgurganus

    Error accessing PDF files from Java

    rgurganus Level 1
      In CF7, I have a routine that opens submitted PDF files through Java to do some manipulation. Similar to CF8 PDF manipulation, but more complex. In almost all cases, it works fine, except two.

      For one, a submitted PDF was corrupted somehow -- I can't even open it with Acrobat. On the line: "reader=pdfReader.init(pdfFile);" this returns the error below. This is expected. But with a couple other PDF's, that do open fine in Acrobat, I get the same error. I even re-saved the PDF file to different versions of Acrobat, but java still complains. Any ideas what causes this, or what to do to prevent it?

      Does anyone know if CF8 java processing does anything different here that would prevent problems like this?

      An exception occurred when instantiating a java object. The cause of this exception was that: .

      From the stack trace:
      at sun.reflect.GeneratedConstructorAccessor48126.newInstance(Unknown Source)
        • 1. Re: Error accessing PDF files from Java
          garyrgi Level 1

          Does this usually happen after you have already processed a couple of pdf's or right away?

          It could also be a problem with your third party tool. I would write a small java class that does nothing other than run the one line and see if you get the same problems with the same files.

          • 2. Re: Error accessing PDF files from Java
            rgurganus Level 1
            It does always happen after having successfully done others, as these are in a list of about a dozen that it processes at a time... but it is always consistent - it does all the others fine, and then always breaks on these particular PDF files, time after time, day after day. So it's not a random thing that comes and goes.

            The 3rd party tool is the one that's "built-in" to CF, com.lowagie.text.pdf.PdfReader. This is all on a shared host, and so I wouldn't have access to installing alternatives.