We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Prevent PDF Tampering and detect if it is tampered

Hi,

Is there a way of detecting if a PDF has been tampered with? I want to make sure that the PDF is exactly the same as the source generated it.

Thanks!

@igorguerra

In order to avoid PDF files from modifications or tampering, you can convert them into PDF/A compliant format(s). If a PDF is PDF/A compliant, it cannot be changed and PDF/A compliance will be removed if some changes are made to the document. Please check below article(s) in API document to convert PDF into PDF/A:

Hi Asad,

Thanks for getting back to me. What you’re proposing is that I convert the PDF into PDF/A and in the future I’ll be able to know if this PDF/A was changed or not, is that accurate?

The problem is, I’m not generating the PDF, I’m just reading it. But I need to make sure that the data I’m reading is exactly what the person who generated the PDF put there and that no one modified it. Is this possible?

Thanks!

@igorguerra

Yes. If a PDF/A document is tampered, it would not remain PDF/A compliant anymore.

In that case, you can try to compare creation and modification dates of the document:

Document doc = new Document("input.pdf");
DocumentInfo Info = new DocumentInfo(doc);

var modDate = Info.ModDate;
var createDate = Info.CreationDate;