I built a PDF converter for different files formats (e.g. Word, Excel, Powerpoint and some bitmap formats e.g. jpg, gif, png). Based on the extension of the inputFile, I’m using Aspose.Word.Document.SaveToPdf(outputFile) for Word, Aspose.Cells.Workbook.Save(outputFile, FileFormattype.Pdf) for Excel, Aspose.Slides.Presentation.Save(outputFile, SaveFormat.Pdf) for Powerpoint and Aspose.Pdf.Pdf.Save(outputFile) for bitmaps.
Everything is working perfectly so far. Thank you so much for making all this so easy for us!
Here is my question:
What happens if the conversion fails? Let’s say I have an input file called “test.doc” which is not in MS Word format. What is Aspose.Word.Document.SaveToPdf() going to do? As all the methods mentioned above have no return type, how can I tell if the conversion was successful and led to a valid PDF?
Is there a way I can check, if a certain file is a valid PDF?