Multiline markup annotations with iText

陌路散爱 提交于 2019-12-25 07:25:14

问题


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:


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.



来源:https://stackoverflow.com/questions/18208636/multiline-markup-annotations-with-itext

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!