You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by Constantine Dokolas <cd...@gmail.com> on 2026/04/20 15:25:07 UTC

Invalid Annots dictionary entries: how to ignore

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

Re: Invalid Annots dictionary entries: how to ignore

Posted by Constantine Dokolas <cd...@gmail.com>.
I understand.

Keep up the good work,
Constantine

On Thu, May 28, 2026 at 8:32 PM Tilman Hausherr <TH...@t-online.de>
wrote:

> Am 28.05.2026 um 11:35 schrieb Constantine Dokolas:
> > I tested it with the debugger app. It works very well. The page renders
> and
> > the exceptions are only logged.
> >
> > Can we expect this to be out in version 3.0.8?
>
> Yes, but I don't know when this will be. The previous version isn't that
> long ago and now it's summer.
>
> Tilman
>
>
> >
> > Thanks a million,
> > Constantine
> >
> > --
> > There is a computer disease that anybody who works with computers knows
> > about. It's a very serious disease and it interferes completely with the
> > work. The trouble with computers is that you 'play' with them!
> > - Richard P. Feynman
> >
> >
> > On Wed, May 27, 2026 at 9:08 PM Tilman Hausherr <TH...@t-online.de>
> > wrote:
> >
> >> https://issues.apache.org/jira/browse/PDFBOX-6206
> >>
> >> fixed, you can try a snapshot here
> >>
> >>
> https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox-app/3.0.8-SNAPSHOT/
> >>
> >> Tilman
> >>
> >> Am 27.05.2026 um 15:14 schrieb Constantine Dokolas:
> >>> Thank you for replying. I appreciate it.
> >>>
> >>> Unfortunately the document contains sensitive info. I hope you can
> >>> replicate the issue using the following debugger screenshot:
> >>>
> >>> image.png
> >>>
> >>> Thanks for taking the time,
> >>> Constantine
> >>>
> >>> --
> >>> There is a computer disease that anybody who works with computers
> >>> knows about. It's a very serious disease and it interferes completely
> >>> with the work. The trouble with computers is that you 'play' with them!
> >>> - Richard P. Feynman
> >>>
> >>>
> >>> On Wed, May 27, 2026 at 3:31 PM Tilman Hausherr
> >>> <TH...@t-online.de> wrote:
> >>>
> >>>      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
> >>>      <cd...@gmail.com>
> >>>      > 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: users-unsubscribe@pdfbox.apache.org
> >>>      For additional commands, e-mail: users-help@pdfbox.apache.org
> >>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>

Re: Invalid Annots dictionary entries: how to ignore

Posted by Tilman Hausherr <TH...@t-online.de>.
Am 28.05.2026 um 11:35 schrieb Constantine Dokolas:
> I tested it with the debugger app. It works very well. The page renders and
> the exceptions are only logged.
>
> Can we expect this to be out in version 3.0.8?

Yes, but I don't know when this will be. The previous version isn't that 
long ago and now it's summer.

Tilman


>
> Thanks a million,
> Constantine
>
> --
> There is a computer disease that anybody who works with computers knows
> about. It's a very serious disease and it interferes completely with the
> work. The trouble with computers is that you 'play' with them!
> - Richard P. Feynman
>
>
> On Wed, May 27, 2026 at 9:08 PM Tilman Hausherr <TH...@t-online.de>
> wrote:
>
>> https://issues.apache.org/jira/browse/PDFBOX-6206
>>
>> fixed, you can try a snapshot here
>>
>> https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox-app/3.0.8-SNAPSHOT/
>>
>> Tilman
>>
>> Am 27.05.2026 um 15:14 schrieb Constantine Dokolas:
>>> Thank you for replying. I appreciate it.
>>>
>>> Unfortunately the document contains sensitive info. I hope you can
>>> replicate the issue using the following debugger screenshot:
>>>
>>> image.png
>>>
>>> Thanks for taking the time,
>>> Constantine
>>>
>>> --
>>> There is a computer disease that anybody who works with computers
>>> knows about. It's a very serious disease and it interferes completely
>>> with the work. The trouble with computers is that you 'play' with them!
>>> - Richard P. Feynman
>>>
>>>
>>> On Wed, May 27, 2026 at 3:31 PM Tilman Hausherr
>>> <TH...@t-online.de> wrote:
>>>
>>>      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
>>>      <cd...@gmail.com>
>>>      > 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: users-unsubscribe@pdfbox.apache.org
>>>      For additional commands, e-mail: users-help@pdfbox.apache.org
>>>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: Invalid Annots dictionary entries: how to ignore

Posted by Constantine Dokolas <cd...@gmail.com>.
I tested it with the debugger app. It works very well. The page renders and
the exceptions are only logged.

Can we expect this to be out in version 3.0.8?

Thanks a million,
Constantine

--
There is a computer disease that anybody who works with computers knows
about. It's a very serious disease and it interferes completely with the
work. The trouble with computers is that you 'play' with them!
- Richard P. Feynman


On Wed, May 27, 2026 at 9:08 PM Tilman Hausherr <TH...@t-online.de>
wrote:

> https://issues.apache.org/jira/browse/PDFBOX-6206
>
> fixed, you can try a snapshot here
>
> https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox-app/3.0.8-SNAPSHOT/
>
> Tilman
>
> Am 27.05.2026 um 15:14 schrieb Constantine Dokolas:
> > Thank you for replying. I appreciate it.
> >
> > Unfortunately the document contains sensitive info. I hope you can
> > replicate the issue using the following debugger screenshot:
> >
> > image.png
> >
> > Thanks for taking the time,
> > Constantine
> >
> > --
> > There is a computer disease that anybody who works with computers
> > knows about. It's a very serious disease and it interferes completely
> > with the work. The trouble with computers is that you 'play' with them!
> > - Richard P. Feynman
> >
> >
> > On Wed, May 27, 2026 at 3:31 PM Tilman Hausherr
> > <TH...@t-online.de> wrote:
> >
> >     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
> >     <cd...@gmail.com>
> >     > 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: users-unsubscribe@pdfbox.apache.org
> >     For additional commands, e-mail: users-help@pdfbox.apache.org
> >
>

Re: Invalid Annots dictionary entries: how to ignore

Posted by Tilman Hausherr <TH...@t-online.de>.
https://issues.apache.org/jira/browse/PDFBOX-6206

fixed, you can try a snapshot here
https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox-app/3.0.8-SNAPSHOT/

Tilman

Am 27.05.2026 um 15:14 schrieb Constantine Dokolas:
> Thank you for replying. I appreciate it.
>
> Unfortunately the document contains sensitive info. I hope you can 
> replicate the issue using the following debugger screenshot:
>
> image.png
>
> Thanks for taking the time,
> Constantine
>
> --
> There is a computer disease that anybody who works with computers 
> knows about. It's a very serious disease and it interferes completely 
> with the work. The trouble with computers is that you 'play' with them!
> - Richard P. Feynman
>
>
> On Wed, May 27, 2026 at 3:31 PM Tilman Hausherr 
> <TH...@t-online.de> wrote:
>
>     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
>     <cd...@gmail.com>
>     > 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: users-unsubscribe@pdfbox.apache.org
>     For additional commands, e-mail: users-help@pdfbox.apache.org
>

Re: Invalid Annots dictionary entries: how to ignore

Posted by Constantine Dokolas <cd...@gmail.com>.
Thank you for replying. I appreciate it.

Unfortunately the document contains sensitive info. I hope you can
replicate the issue using the following debugger screenshot:

[image: image.png]

Thanks for taking the time,
Constantine

--
There is a computer disease that anybody who works with computers knows
about. It's a very serious disease and it interferes completely with the
work. The trouble with computers is that you 'play' with them!
- Richard P. Feynman


On Wed, May 27, 2026 at 3:31 PM Tilman Hausherr <TH...@t-online.de>
wrote:

> 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 <cdokolas@gmail.com
> >
> > 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: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>

Re: Invalid Annots dictionary entries: how to ignore

Posted by Tilman Hausherr <TH...@t-online.de>.
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 <cd...@gmail.com>
> 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: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Re: Invalid Annots dictionary entries: how to ignore

Posted by Constantine Dokolas <cd...@gmail.com>.
No one is willing to reply?

:(

Constantine


On Tue, Apr 21, 2026 at 11:33 AM Constantine Dokolas <cd...@gmail.com>
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
>

Fwd: Invalid Annots dictionary entries: how to ignore

Posted by Constantine Dokolas <cd...@gmail.com>.
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