Scan for corrupted PDFs

I see the thread from 24th Feb in the forum, but it appears “isPDF” didn’t quite do what was require? I need to be able to tell if a PDF can be opened for reading and is not damaged. I’ve inherited lots of PDFs (many are “scanned” - image only) and need to locate any damaged ones (i.e. which cannot be opened in Adobe reader). The documentation doesn’t say how the “isPDF” method works or how deep the checks are. Can you confirm:

a) that “isPDF” means the file can always be opened in Adobe Reader (or does it just locate the initial “PDF” signature on the file)
b) that it also means “scanned PDFs” (image only) can be opened in Adobe Reader.
c) can I get a page count for both scanned PDFs and ordinary ones? I’ve been using another commonly available tool, but it often throws exceptions when trying to get the page count from valid “scanned PDFs” so the results are misleading.

Sorry for all the questions, but I know Aspose tools are great (have used Words and Cells). I don’t need to OCR the “scanned PDFs” (image only) I just need to know they are valid PDFs which can be opened.

Thanks in advance

Barry

@bclark.ific.co.uk

Thank you for contacting support.

We would like to share with you that we did not notice any anomaly with IsPdfFile property. It checks if the structure and content of a PDF matches, along with other necessary requirements of PDF file format. In case you have noticed a problem with this property, then please share respective file along with a code snippet reproducing this issue.

IsPdfFile property returns true only if the PDF file is all good, so that file can obviously be opened in Adobe Reader. Moreover, the scanned PDF files are valid PDF files thus Aspose.PDF as well as Adobe Reader processes such files without any problem. Furthermore, you can get page count of any PDF document without any problem by using the lines of code below:

Document document = new Document(dataDir + "Test.pdf");
int pagecount = document.Pages.Count;

In case you notice any problem, please report it to us so that we may proceed to help you out.