pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: PDAnnotationMarkup.getInReplyTo
Date Wed, 24 Feb 2016 07:39:30 GMT
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

> 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.

> I'd be interested to know if there are other places in PDFs where an object
> can be referenced from multiple locations in the document and where the
> identity of that object is important.

Everywhere! Many objects (even a number) can be direct or indirect. And 
those who are indirect don't know their own object number.


> How hard do you think it would be to make objects know their object number
> once they're dereferenced? Or perhaps there's another way to deal with this?
> Thanks,
> David

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

View raw message