PDF Certification
Contents
[
Hide
]
Certify PDF documents
Use certification when the document should remain trusted but still allow a defined class of changes after signing.
Steps
- Create a
PdfFileSignatureinstance and bind the source PDF. - Build a
PKCS7signature object with the certificate and certificate password. - Wrap that signature in a
DocMDPSignaturewith the requiredDocMDPAccessPermissionsvalue. - Call
certifywith the target page, signature metadata, visible rectangle, and MDP signature. - Save the certified PDF and close the facade object.
Java example
public static void certifyPdfWithMdpSignature(Path inputFile, Path certificateFile, Path outputFile) {
PdfFileSignature pdfSignature = new PdfFileSignature();
try {
pdfSignature.bindPdf(inputFile.toString());
DocMDPSignature signature = new DocMDPSignature(
createPkcs7(certificateFile, "Certified for form filling and signing"),
DocMDPAccessPermissions.FillingInForms);
pdfSignature.certify(1, "Certified for form filling and signing", "security@example.com", "New York, USA", true, signatureRectangle(), signature);
pdfSignature.save(outputFile.toString());
} finally {
pdfSignature.close();
}
}