Aspose PDF TextAbsorber object reference exception

Hello,

I have a problem with aspose.pdf when I use the TextAbsorber after get the size of the document with one document in particular.

image.png (291.6 KB)

See sample to reproduce in attachementConsoleAppTestAsposeTextAbsorber.zip (1.2 MB)

Thanks for your help,
Regards,
Nicolas

@NNO

You are facing this error because you are saving the document into MemoryStream before extracting the text. Please note that Document.Save() method behaves just like dispose method as it clears all opened streams and resources from the memory. This is the main reason of this exception. You can do something like this:

using (Document pdfDoc = new Document("2.5 FA22011 95Bis Prestation (1.083,33E) (1).pdf"))
{
    using (PdfFileInfo pdfFileInfo = new PdfFileInfo())
    {
        pdfFileInfo.BindPdf(pdfDoc);
        Size(pdfDoc, pdfFileInfo);//without this methode it's works fine
        var doc = new Document("2.5 FA22011 95Bis Prestation (1.083,33E) (1).pdf");
        for (int i = 1; i <= doc.Pages.Count(); i++)
        {
            string value = Extract(doc.Pages[i]);
        }
    }
}

@asad.ali Ok but I had only have this problem with one pdf. All other work fine.

@NNO

Can you please share the other PDF with which the issue is not being reproduced?

I sent it to you in the project

image.png (19.9 KB)

@NNO

An issue as PDFNET-52777 has been logged in our issue tracking system for further investigation. We will look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

The issues you have found earlier (filed as PDFNET-52777) have been fixed in Aspose.PDF for .NET 25.5.