OpenPDF icon indicating copy to clipboard operation
OpenPDF copied to clipboard

ClassCastException in PdfReader.consolidateNamedDestinations: com.lowagie.text.pdf.PdfArray cannot be cast to class com.lowagie.text.pdf.PdfString

Open andreasrosdal opened this issue 3 years ago • 4 comments

I get this ClassCastException in OpenPDF version 1.3.27:

java.lang.ClassCastException: class com.lowagie.text.pdf.PdfArray cannot be cast to class com.lowagie.text.pdf.PdfString (com.lowagie.text.pdf.PdfArray and com.lowagie.text.pdf.PdfString are in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @6c901f0e) at com.lowagie.text.pdf.PdfNameTree.iterateItems(PdfNameTree.java:157) at com.lowagie.text.pdf.PdfNameTree.iterateItems(PdfNameTree.java:163) at com.lowagie.text.pdf.PdfNameTree.readTree(PdfNameTree.java:171) at com.lowagie.text.pdf.PdfReader.getNamedDestinationFromStrings(PdfReader.java:2876) at com.lowagie.text.pdf.PdfReader.getNamedDestination(PdfReader.java:2814) at com.lowagie.text.pdf.PdfReader.consolidateNamedDestinations(PdfReader.java:3057)

https://github.com/LibrePDF/OpenPDF/blob/master/openpdf/src/main/java/com/lowagie/text/pdf/PdfNameTree.java#L157

andreasrosdal avatar May 09 '22 10:05 andreasrosdal

hi Andreas, would you have a pdf to test? Looks like a sort error in the pdf itself which needs to be catched.

koenvb avatar May 13 '22 16:05 koenvb

I have such as a PDF file to reproduce this problem, can you please send me an email to andreas.rosdal AT gmail.com and I will share the PDF file with you. Thank you.

@koenvb

andreasrosdal avatar May 23 '22 16:05 andreasrosdal

Hi, il there any news about this problem ?

guyruisseau avatar Apr 03 '23 12:04 guyruisseau

This bug is still present in OpenPDF 1.3.30. @guyruisseau (Still same stack trace)

andreasrosdal avatar Apr 14 '23 12:04 andreasrosdal