3.6.  Certified PDF

Overview

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)

Examples

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)
  ;
}

Certification Level

PDFUnit provides constants for the certification level:

com.pdfunit.Constants.NO_CHANGES_ALLOWED
com.pdfunit.Constants.FORM_FILLING
com.pdfunit.Constants.FORM_FILLING_AND_ANNOTATIONS