我在Acrobat中创建了一些注释(Underline,Highlight,Strikeout,Squiggly),并且正在挖掘QuadPoints数组以进行渲染.pdf规范PDF 32000-1:2008表示它们是逆时针顺序,x1,y1 - > x2,y2指定四边形的基数.
这看起来应该是:BottomLeft,BottomRight,TopRight,TopLeft
不幸的是,Acrobat似乎以不同的(并且不合规的方式)创建它们.
看起来好像订单是:TopLeft,TopRight,BottomLeft,BottomRight.
有人对这种现象有所了解吗?它一致吗?我错过了什么吗?
根据以下帖子: iTextSharp PDF 使用 C# 读取突出显示的文本(突出显示注释)
这段代码:
for (int i = pageFrom; i <= pageTo; i++) {
PdfDictionary page = reader.GetPageN(i);
PdfArray annots = page.GetAsArray(iTextSharp.text.pdf.PdfName.ANNOTS);
if (annots!=null)
foreach (PdfObject annot in annots.ArrayList) {
PdfDictionary annotation = (PdfDictionary)PdfReader.GetPdfObject(annot);
PdfString contents = annotation.GetAsString(PdfName.CONTENTS);
// now use the String value of contents
}
}
}
Run Code Online (Sandbox Code Playgroud)
正在努力提取 PDF 注释。但是为什么以下相同的代码无法突出显示(特别是 PdfName.HIGHLIGHT 不起作用):
for (int i = pageFrom; i <= pageTo; i++) {
PdfDictionary page = reader.GetPageN(i);
PdfArray annots = page.GetAsArray(iTextSharp.text.pdf.PdfName.HIGHLIGHT);
if (annots!=null)
foreach (PdfObject annot …Run Code Online (Sandbox Code Playgroud)