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]);
}
}
}
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.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.