You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Jonny O <jo...@gmail.com> on 2013/10/31 11:21:17 UTC

PDFBox PDAnnotation Multiple Quads

Hello.

I am using PDFBox to both extract annotations from, and add annotations to
a PDF file. I originally used JavaScript within Acrobat to do this, but it
is much too slow and very restricted. So it is very nice to use PDFbox.

However, all subclasses of PDAnnotation only seem to allow the user to get
or set one quad. The problem however is that Acrobat can create multiple
quads for the one annotation (as it appears to me). For example, if a user
creates a single highlight across two or more lines, several individual
boxes (quads) will be seen, however, they act as one when editing or
deleting.

JavaScript in Acrobat accepts a 2D Array when getting or setting quads. Is
it possible to replicate this using PDFBox? Perhaps this functionality was
left out due to the complexity of the PDF structure?

I have exhausted my time and knowledge on this one, and I hope some advice
might help me get some energy back :)

Thank you for your time.
Jonny O.

Re: PDFBox PDAnnotation Multiple Quads

Posted by Gilad Denneboom <gi...@gmail.com>.
The array of floats returned by
getQuadPoints<http://pdfbox.apache.org/apidocs/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationTextMarkup.html>()
will return all of the quads associated with the annotation, in a single
array.
Each group of 8 floats represents one quad.


On Thu, Oct 31, 2013 at 11:21 AM, Jonny O <jo...@gmail.com> wrote:

> Hello.
>
> I am using PDFBox to both extract annotations from, and add annotations to
> a PDF file. I originally used JavaScript within Acrobat to do this, but it
> is much too slow and very restricted. So it is very nice to use PDFbox.
>
> However, all subclasses of PDAnnotation only seem to allow the user to get
> or set one quad. The problem however is that Acrobat can create multiple
> quads for the one annotation (as it appears to me). For example, if a user
> creates a single highlight across two or more lines, several individual
> boxes (quads) will be seen, however, they act as one when editing or
> deleting.
>
> JavaScript in Acrobat accepts a 2D Array when getting or setting quads. Is
> it possible to replicate this using PDFBox? Perhaps this functionality was
> left out due to the complexity of the PDF structure?
>
> I have exhausted my time and knowledge on this one, and I hope some advice
> might help me get some energy back :)
>
> Thank you for your time.
> Jonny O.
>