Open veera-raghavagupta opened 2 years ago
You can ignore these non critical errors with the option PdfReadAccuracy.Moderate.
Full code: int pageCount = PdfReader.Open(memoryStream, PdfDocumentOpenMode.ReadOnly, PdfReadAccuracy.Moderate).PageCount;
I'm encountering a similar problem. I'm attempting to utilize the PdfReadAccuracy.Moderate enumeration, but I'm unable to locate an overload method signature for PdfReader.Open(memoryStream, PdfDocumentOpenMode.ReadOnly, PdfReadAccuracy.Moderate). Could you please advise me on which version I should be using? Currently, I am working with PdfSharpCore -Version 1.3.57.
For further clarification. I am also using version 1.3.57, and the solution described by @aabiryukov works just fine and solved the problem we had reading old PDFs.
While uploading the pdf document (Version 1.4) when we try to read the page count of the PDF file is throwing error from below line of code.
int pageCount = PdfReader.Open(memoryStream, PdfDocumentOpenMode.ReadOnly).PageCount;
Exception Details: Invalid entry in XRef table, ID=2, Generation=0, Position=118, ID of referenced object=2, Generation of referenced object=65536
Can somebody help me on this?