A “certified PDF” is a regular PDF with additional information. It contains information about how it can be changed.
For certified PDF PDFUnit provides these test methods:
// Tests for certified PDF:
.isCertified()
.isCertifiedFor(FORM_FILLING)
.isCertifiedFor(FORM_FILLING_AND_ANNOTATIONS)
.isCertifiedFor(NO_CHANGES_ALLOWED)
First you can check that a document is certified at all:
@Test public void isCertified() throws Exception { String filename = "sampleCertifiedPDF.pdf"; AssertThat.document(filename) .isCertified() ; }
Next you can check the level of certification:
@Test public void isCertifiedFor_NoChangesAllowed() throws Exception { String filename = "sampleCertifiedPDF.pdf"; AssertThat.document(filename) .isCertifiedFor(NO_CHANGES_ALLOWED) ; }