I did read it then for some reason did nothing.
The problem is that the return value is an array backed by the
annotation COSArray, so this doesn't really work if we'd have a
different number in the COSArray and in the annotation array.
However I see that it is already done that we skip stuff if it is
filtered, so maybe we should skip exceptions as well. It looks like this
now:
PDAnnotation createdAnnotation =
PDAnnotation.createAnnotation(item);
if (annotationFilter.accept(createdAnnotation))
{
actuals.add(createdAnnotation);
}
and we could change it like this:
try
{
PDAnnotation createdAnnotation =
PDAnnotation.createAnnotation(item);
if (annotationFilter.accept(createdAnnotation))
{
actuals.add(createdAnnotation);
}
}
catch (IOException ex)
{
LOG.error(ex.getMessage(), ex);
}
Can you share such a file?
Tilman
Am 27.05.2026 um 11:22 schrieb Constantine Dokolas:
No one is willing to reply?
:(
Constantine
On Tue, Apr 21, 2026 at 11:33 AM Constantine Dokolas <[email protected]>
wrote:
I sent this to the "dev" list by mistake. Reposting to "users"...
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
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]