pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Lattimore <...@google.com.INVALID>
Subject Re: PDAnnotationMarkup.getInReplyTo
Date Wed, 24 Feb 2016 22:38:06 GMT
On Wed, Feb 24, 2016 at 6:39 PM, Tilman Hausherr <THausherr@t-online.de>

> Am 24.02.2016 um 06:21 schrieb David Lattimore:
>> I'm trying to read annotations from PDFs and am having trouble matching up
>> replies with the annotations they're in reply to.
>> PDPage.getAnnotations() returns a list of PDAnnotation. When I have
>> a PDAnnotationMarkup, I try to call getInReplyTo to get the previous
>> annotation in the thread. But I have two problems:
>> 1) getInReplyTo() crashes if the annotation isn't a reply. It'd be nice if
>> it just returned null. I can work around this by getting the COSDictionary
>> and checking for an IRT entry first.
> Please post a stack trace

java.io.IOException: Error: Unknown annotation type null

The following code can be used to reproduce this:
new PDAnnotationMarkup().getInReplyTo();

> 2) The PDAnnotation returned by getInReplyTo() isn't one of the annotations
>> returned by PDPage.getAnnotations() and I can't see how I can match them
>> up. Ideally I'd like to get the object ID for each, but the PDAnnotation
>> doesn't seem to know it's object ID as far as I can see. I could match
>> them
>> by keying on various attributes of the annotation like the text content
>> and
>> the timestamp, but this feels pretty hacky.
> try getCOSObject(), this should work.

Ah, of course. That does indeed work. Sorry I didn't think of that myself
and thank you.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message