阅读PDF批注与iText的 [英] Reading PDF Annotations with iText
问题描述
我试图让PDF注释字符串的内容,所以我可以存储在搜索目的的数据库信息。
I trying to get the contents of a PDF annotation to string so I can store that information in a database for searching purposes.
有谁知道如何做到这一点利用iText / iTextSharp的?
Does anyone know how to accomplish this using iText/iTextSharp?
推荐答案
是的,但具体细节真的取决于什么样的[S]你在谈论的注解
Yes, but the specifics really depend on what kind[s] of annotations you're talking about.
在一般的:
PdfDictionary pageDict = myPdfReader.getPageN(firstPageIsOne);
PdfArray annotArray = pageDict.getAsArray(PdfName.ANNOTS);
for (int i = 0; i < annotArray.size(); ++i) {
PdfDictionary curAnnot = annotArray.getAsDict(i);
int someType = myCodeToGetAnAnnotsType(curAnnot);
if (someType == THIS_TYPE) {
writeThisType(curAnnot);
} else if (someType == THAT_TYPE) {
writeThatType(curAnnot);
}
}
有关详细信息,你需要检查< A HREF =http://www.adobe.com/content/dam/Adobe/en/devnet/pdf/pdfs/PDF32000_2008.pdf相对=nofollow> PDF规格,特别注释说明:章12.5.6注释类型
For details, you'll need to examine the PDF Specification, in particular the annotation descriptions: "Chapter 12.5.6 Annotation Types".
如果你能告诉我们你关心,我可以有更多的帮助是什么类型
If you can tell us what types you care about, I can be of more help.
这篇关于阅读PDF批注与iText的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!