使用iText进行多行标记注释 [英] Multiline markup annotations with iText
问题描述
我想使用iText突出显示PDF文档中的文本段落。此段落也可以跨越多条线,因此突出显示的区域不一定是一个矩形。
但是对于 PdfAnnotation.createMarkup(...)
方法我只能传递或描述一个矩形,而且PDF引用只允许四个 QuadPoints
来描述该区域。
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.
推荐答案
PDF规范中的QuadPoints是一个8 * n个元素的数组,其中每组8个元素(x1,y1,x2,y2,x3,y3,x4,y4)定义高亮矩形的4个角。 br />
PdfAnnotation.createMarkup的最后一个参数是一个接受上述值的数组。
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.
这篇关于使用iText进行多行标记注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!