Hi all!

I'm working with a PDF that has an invalid "Annots" dictionary on a page.
The issue is that the dictionary is just an array of ints (COSInt). Because
of that, parsing the page throws this exception (this is as it appears in
the PDFBox debugging app):

java.lang.RuntimeException: java.util.concurrent.ExecutionException:
> java.io.IOException: Error: Unknown annotation type COSInt{278}
>
> org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.done(PagePane.java:584)
>
> java.desktop/sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)
> Caused by: java.util.concurrent.ExecutionException: java.io.IOException:
> Error: Unknown annotation type COSInt{278}
>
> org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.done(PagePane.java:569)
>
> java.desktop/sun.swing.AccumulativeRunnable.run(AccumulativeRunnable.java:112)
> Caused by: java.io.IOException: Error: Unknown annotation type COSInt{278}
>
> org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation.createAnnotation(PDAnnotation.java:166)
>     org.apache.pdfbox.pdmodel.PDPage.getAnnotations(PDPage.java:779)
>     org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:291)
>
> org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:348)
>
> org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.doInBackground(PagePane.java:546)
>
> org.apache.pdfbox.debugger.pagepane.PagePane$RenderWorker.doInBackground(PagePane.java:525)
>     java.base/java.lang.Thread.run(Thread.java:1474)


Is there, perhaps (I don't expect there is), a way to ignore these entries?
The issue is that most PDF viewers ignore these entries, but PDFBox crashes.

Generally, we have difficulty explaining to our customers that PDFs must be
well-formed and standards-compliant for us to process them, but the usual
counter-argument is "but it works with Acrobat!"
I wonder if anyone has suggestions (that work IRL) on how to counter this
argument.

Have a great day,
Constantine

Reply via email to