How to detect corrupt PDF prior to saving to image?

Is there anyway to detect if a PDF is valid before attempting to convert it to an image? I’m seeing this exception when attempting to save a page from a PDF, but there is no indication that there is any issues prior to making this call:


System.ArgumentException : Corrupt content.
at ˜..€(„ , † , Boolean ) at ˜..( , Ÿ , ) at ..€() at Aspose.Pdf.Devices.TiffDevice.Process(Document document, Int32 fromPage, Int32 toPage, Stream output)

and/or

ž.• : Wrong format of PDF String.
at –...(œ , „& ) at ž.–.(œ , „& ) at –.‡.(Byte[] buffer, œ reader, „& newPrimitive) at ž..€() at ž.Ÿ.(† ) at ˜..€(„ , † , Boolean ) at ˜..( , Ÿ , ) at ..€() at Aspose.Pdf.Devices.TiffDevice.Process(Document document, Int32 fromPage, Int32 toPage, Stream output)


The Aspose.Pdf.Document.IgnoreCorruptedObjects property defaults to true, so it seems to do nothing useful in this scenario. We would like to detect if there are any issues with a PDF upfront so we can reject a PDF upload right away instead of waiting to see if it fails conversion later.

Hi Barry,


Thanks for your inquiry. Could you please share your source document here? So we will test it at our end and provide you more information.

Sorry for the inconvenience faced.

Best Regards,