Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

Particular PDF causes null reference exception to be thrown

$
0
0
On page 1456 of this document, Aspose.PDF 10.1.0 throws a null reference exception. Aspose 9.9.0 runs fine.

using (FileStream fs = new FileStream(this.pdfPath, FileMode.Open, FileAccess.Read, FileShare.Read))
{
if (fs.CanRead)
{
MemoryStream ms = new MemoryStream();
fs.CopyTo(ms);
this.pdfDocument = new Aspose.Pdf.Document(ms, true);
}
}


try{
TextAbsorber textAbsorber = new TextAbsorber
{
ExtractionOptions =
{
FormattingMode = Aspose.Pdf.Text.TextOptions.TextExtractionOptions.TextFormattingMode.Raw
}
};

this.pdfDocument.Pages[1456].Accept(textAbsorber);
textToReturn = textAbsorber.Text;
catch (Exception ex) {
Logger.LogError(@"PdfOcrDocument.GetTextForPage caught exception and is returning no text: {0}", ex.ToString());
}



Viewing all articles
Browse latest Browse all 3131

Trending Articles