如何使用itextsharp API从PDF读取特定页面的内容 [英] How to read contents of specific page from PDF using itextsharp APIs
本文介绍了如何使用itextsharp API从PDF读取特定页面的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用itextsharp API从PDF读取特定页面的内容
How to read contents of specific page from PDF using itextsharp APIs
任何人都可以将我重定向到正确的方向吗?
Can anybody redirect me to the correct direction?
提前致谢!
推荐答案
以下代码仅提取文字,如果您正在寻找的话。 / p>
The following code only extracts text, if that is what you are looking for.
PdfReader pdfReader = new PdfReader(documentPath);
ITextExtractionStrategy its = new iTextSharp.text.pdf.parser.SimpleTextExtractionStrategy();
//Extract text from the page.
string txt = PdfTextExtractor.GetTextFromPage(pdfReader, page, its);
// Convert the extracted text into a readable string using the right encoding.
extractedText = Encoding.UTF8.GetString(ASCIIEncoding.Convert(Encoding.Default, Encoding.UTF8, Encoding.Default.GetBytes(txt)));
这篇关于如何使用itextsharp API从PDF读取特定页面的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文