Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用itextsharp API从PDF中读取特定页面的内容_Pdf_C# 2.0_Itextsharp - Fatal编程技术网

如何使用itextsharp API从PDF中读取特定页面的内容

如何使用itextsharp API从PDF中读取特定页面的内容,pdf,c#-2.0,itextsharp,Pdf,C# 2.0,Itextsharp,如何使用itextsharp API从PDF中读取特定页面的内容 有人能把我引向正确的方向吗 提前谢谢 以下代码仅提取文本(如果您正在寻找文本) PdfReader pdfReader = new PdfReader(documentPath); ITextExtractionStrategy its = new iTextSharp.text.pdf.parser.SimpleTextExtractionStrategy(); //Extract text from the page. s

如何使用itextsharp API从PDF中读取特定页面的内容

有人能把我引向正确的方向吗


提前谢谢

以下代码仅提取文本(如果您正在寻找文本)

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)));
“特定页面的内容”指的是页面的文本,还是页面的实际内容流。