我正在开发一个C# winform应用程序,将pdf内容转换为文本。除了在pdf的高亮文本中找到的内容之外,所有需要的内容都被提取。请帮助获取工作样本,以提取在pdf中发现的突出显示的文本。我在项目中使用iTextSharp.dll
发布于 2014-04-28 21:53:17
假设你谈论的是评论。请尝试以下操作:
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
}
}
}
这是从内存中编写的(我是Java开发人员,不是C#开发人员)。
https://stackoverflow.com/questions/23342500
复制相似问题