iTextSharp的V5 GetTextFromPage()抛出IndexOutOfRangeException [英] iTextSharp v5 GetTextFromPage() throws IndexOutOfRangeException

查看:284
本文介绍了iTextSharp的V5 GetTextFromPage()抛出IndexOutOfRangeException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图提取PDF文件的文本内容与下面的code:

Trying to extract the textual content of a pdf with the following code:

PdfReader reader = new PdfReader(path);
string strText = string.Empty;

for (int page = 1; page <= reader.NumberOfPages; page++)
{
    string s = PdfTextExtractor.GetTextFromPage(reader, page);
    strText += " " + s;                
}
reader.Close();

NumberOfPages返回257,但227页,GetTextFromPage()抛出一个IndexOutOfRangeException。

NumberOfPages returns 257, but at page 227, GetTextFromPage() throws a IndexOutOfRangeException.

任何帮助是AP preciated。

Any help is appreciated.

hofnarwillie

hofnarwillie

推荐答案

我通过更新我从5.1版本iTextSharp的,以5.2解决了这个问题。

I resolved this issue by updating my version of iTextSharp from 5.1 to 5.2.

这篇关于iTextSharp的V5 GetTextFromPage()抛出IndexOutOfRangeException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆