Sorry that i cannot attach the problematic PDF file in the forum. Anyway, let me describe more findings in this issue.

When we traced the source code of PdfReader (v1.4), in line 3050, there is a line

iteratePages((PRIndirectReference)kids.get(k));
where kids is an ArrayList.

This class casting logic will not have problem for most PDF files. But for some PDF files, the ArrayList (kids) contains not only PRIndirectReferences, but also contains com.lowagie.text.pdf.PdfLiteral, As the result, this line will throw ClassCastException. Could anybody have idea on this issue. Thank you.

Regards,
Eric



On 4/4/06, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote:
Send iText-questions mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
         https://lists.sourceforge.net/lists/listinfo/itext-questions
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of iText-questions digest..."


Today's Topics:

   1. Throws ClassCastException when instantiating PdfReader with some PDF files (eson tam)

--__--__--

Message: 1
Date: Tue, 4 Apr 2006 12:02:04 +0800
From: "eson tam" <[EMAIL PROTECTED]>
To: [email protected]
Subject: [iText-questions] Throws ClassCastException when instantiating PdfReader with some PDF files

------=_Part_4984_32883340.1144123324336
Content-Type: multipart/alternative;
        boundary="----=_Part_4985_28816879.1144123324336"

------=_Part_4985_28816879.1144123324336
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Our project is using itext 1.4 and trying to concatenate multiple PDF files
to one single PDF file. When we instantiated a new PdfReader on a file, it
throws java.lang.ClassCastException with following stack trace.

java.lang.ClassCastException
        at com.lowagie.text.pdf.PdfReader$PageRefs.iteratePages (Unknown
Source)
        at com.lowagie.text.pdf.PdfReader$PageRefs.readPages(Unknown Source=
)
        at com.lowagie.text.pdf.PdfReader$PageRefs.<init>(Unknown Source)
        at com.lowagie.text.pdf.PdfReader$PageRefs .<init>(Unknown Source)
        at com.lowagie.text.pdf.PdfReader.readPages(Unknown Source)
        at com.lowagie.text.pdf.PdfReader.readPdf(Unknown Source)
        at com.lowagie.text.pdf.PdfReader.<init>(Unknown Source)
        at com.lowagie.text.pdf.PdfReader.<init>(Unknown Source)
        at test.PDFTester.testPDF(Unknown Source)
        at test.PDFTester.mainApp(Unknown Source)
        at test.PDFTester.main(Unknown Source)

Attached is one of the PDF files which encountered such excption. Have
anybody had such occurence before and could anyone have advice on this
issue? Thank you.

Regards,
Eric


Reply via email to