开发者

How to read contents of specific page from PDF using itextsharp APIs

开发者 https://www.devze.com 2023-01-10 06:07 出处:网络
How to read c开发者_如何学运维ontents of specific page from PDF using itextsharp APIs Can anybody redirect me to the correct direction?

How to read c开发者_如何学运维ontents of specific page from PDF using itextsharp APIs

Can anybody redirect me to the correct direction?

Thanks in advance!


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)));
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号