Multiline markup annotations with iText

742 views Asked by At

I want to highlight a text passage in a PDF document using iText. This passage can also span across several lines, so the highlighted region is not necessarily one rectangle. But to the PdfAnnotation.createMarkup(...) methods I can only pass or describe one rectangle and also the PDF reference only allows for four QuadPoints to describe the region.

I would be very happy if I could achieve this with one single annotation. I know that this is possible, because I have seen documents with multi lined highlighted regions that showed up as one single entry in the annotations list.

1

There are 1 answers

0
iPDFdev On BEST ANSWER

The QuadPoints in PDF specification is an array of 8*n elements where each set of 8 elements (x1, y1, x2, y2, x3, y3, x4, y4) defines the 4 corners of a highlighted rectangle.
The last parameter of PdfAnnotation.createMarkup is an array which accepts the values described above.