Class BasicMetadataPDFAConformanceChecker

java.lang.Object
se.idsec.signservice.integration.document.pdf.pdfa.BasicMetadataPDFAConformanceChecker
All Implemented Interfaces:
PDFAConformanceChecker

public class BasicMetadataPDFAConformanceChecker extends Object implements PDFAConformanceChecker
Basic PDF/A conformance checker based on PDF metadata declaration inspection.

This conformance checker only checks if the PDF document metadata claims that the document conforms to the PDF/A standard. This checker does not validate if the present document actually is compliant with PDF/A.

For rules on how to detect PDF/A compliance declaration in metadata, see: https://www.pdfa.org/wp-content/uploads/2011/08/tn0001_pdfa-1_and_namespaces_2008-03-182.pdf

Note that this conformance checker does not support the earlier, but false PDF/A declaration namespaces such as ("http://www.aiim.org/pdfa/ns/id.html" and "http://www.aiim.org/pdfa/ns/id"). However, it is possible to set the namespace identifier to a custom value to alter the behavior of this conformance checker.

  • Field Details

    • DESCRITPION_NS

      public static final String DESCRITPION_NS
      Name space identifier for the descriptions element in PDF metadata
      See Also:
    • DESCRIPTION_ELEMENT_NAME

      public static final String DESCRIPTION_ELEMENT_NAME
      Description element name
      See Also:
    • PART_ELEMENT_NAME

      public static final String PART_ELEMENT_NAME
      PDF/A part element name
      See Also:
    • CONFORMANCE_ELEMENT_NAME

      public static final String CONFORMANCE_ELEMENT_NAME
      PDF/A conformance element name
      See Also:
    • pdfaIdNs

      public String pdfaIdNs
      Name space identifier for PDF/A declarations in PDF metadata
  • Constructor Details

    • BasicMetadataPDFAConformanceChecker

      public BasicMetadataPDFAConformanceChecker()
      Constructor
  • Method Details

    • checkPDFAConformance

      public PDFAStatus checkPDFAConformance(org.apache.pdfbox.pdmodel.common.PDMetadata metadata)
      Examines PDF document metadata for declarations that this PDF is compliant with the PDF/A profile.
      Specified by:
      checkPDFAConformance in interface PDFAConformanceChecker
      Parameters:
      metadata - PDF document metadata
      Returns:
      PDF/A declaration data
    • isPDFAConsistent

      public boolean isPDFAConsistent(org.apache.pdfbox.pdmodel.PDDocument tbsDoc, org.apache.pdfbox.pdmodel.PDDocument signPage)
      Predicate that tells whether the tbsDoc and the signPage is "consistent", meaning that the method will return false the main document is PDF/A and the added sign page is not, and true otherwise
      Specified by:
      isPDFAConsistent in interface PDFAConformanceChecker
      Parameters:
      tbsDoc - the pdf document to be signed
      signPage - the sign page added to the document to be signed
      Returns:
      true if constistent and false otherwise
    • assertPDFAConsistency

      public void assertPDFAConsistency(org.apache.pdfbox.pdmodel.PDDocument tbsDoc, org.apache.pdfbox.pdmodel.PDDocument signPage) throws se.idsec.signservice.integration.document.pdf.PdfAConsistencyCheckException
      Check PDF/A consistency between the main document to be signed and a sign page added to the main document.
      Specified by:
      assertPDFAConsistency in interface PDFAConformanceChecker
      Parameters:
      tbsDoc - the pdf document to be signed
      signPage - the sign page added to the document to be signed
      Throws:
      se.idsec.signservice.integration.document.pdf.PdfAConsistencyCheckException - if the main document is PDF/A and the added sign page is not
    • checkPDFADeclaration

      public PDFAStatus checkPDFADeclaration(String metadataStr)
      Examines PDF document metadata for declarations that this PDF is compliant with the PDF/A profile
      Parameters:
      metadataStr - PDF document metadata
      Returns:
      PDF/A declaration data