Hello,
I am using aspose.pdf 4.3.0 and aspose.pdf.kit 4.4.0 , i need to check if a file with a pdf extension is a real pdf file.
Is there a method to do that?
I also need to do the same test for doc, ppt and xls
Please advice,
Hi Karine,
Thanks for contacting support.
In order to determine if the source/input file is PDF, please try using the following code snippet.
[Java]
// load the source file
com.aspose.pdf.facades.PdfFileInfo info = new com.aspose.pdf.facades.PdfFileInfo("C:/PDFTEST/34445.pdf");
// determine if the file is PDF
System.out.println(info.isPdfFile());
Furthermore, we recommend you to please migrate your code from legacy Aspose.Pdf.Kit for Java to autoported MergedAPI release of Aspose.Pdf for Java.
Thank you for the quick response,
It works:)