问题
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 returns 257, but at page 227, GetTextFromPage() throws a IndexOutOfRangeException.
Any help is appreciated.
hofnarwillie
回答1:
I resolved this issue by updating my version of iTextSharp from 5.1 to 5.2.
来源:https://stackoverflow.com/questions/8578793/itextsharp-v5-gettextfrompage-throws-indexoutofrangeexception