Multiline markup annotations with iText

2019-08-30 06:05发布

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条回答
等我变得足够好
2楼-- · 2019-08-30 07:09

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.

查看更多
登录 后发表回答