Class BasicMetadataPDFAConformanceChecker
java.lang.Object
se.idsec.signservice.integration.document.pdf.pdfa.BasicMetadataPDFAConformanceChecker
- All Implemented Interfaces:
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.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringPDF/A conformance element namestatic final StringDescription element namestatic final StringName space identifier for the descriptions element in PDF metadatastatic final StringPDF/A part element nameName space identifier for PDF/A declarations in PDF metadata -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidassertPDFAConsistency(org.apache.pdfbox.pdmodel.PDDocument tbsDoc, org.apache.pdfbox.pdmodel.PDDocument signPage) Check PDF/A consistency between the main document to be signed and a sign page added to the main document.checkPDFAConformance(org.apache.pdfbox.pdmodel.common.PDMetadata metadata) Examines PDF document metadata for declarations that this PDF is compliant with the PDF/A profile.checkPDFADeclaration(String metadataStr) Examines PDF document metadata for declarations that this PDF is compliant with the PDF/A profilebooleanisPDFAConsistent(org.apache.pdfbox.pdmodel.PDDocument tbsDoc, org.apache.pdfbox.pdmodel.PDDocument signPage) Predicate that tells whether thetbsDocand thesignPageis "consistent", meaning that the method will returnfalsethe main document is PDF/A and the added sign page is not, andtrueotherwise
-
Field Details
-
DESCRITPION_NS
Name space identifier for the descriptions element in PDF metadata- See Also:
-
DESCRIPTION_ELEMENT_NAME
Description element name- See Also:
-
PART_ELEMENT_NAME
PDF/A part element name- See Also:
-
CONFORMANCE_ELEMENT_NAME
PDF/A conformance element name- See Also:
-
pdfaIdNs
Name space identifier for PDF/A declarations in PDF metadata
-
-
Constructor Details
-
BasicMetadataPDFAConformanceChecker
public BasicMetadataPDFAConformanceChecker()Constructor
-
-
Method Details
-
checkPDFAConformance
Examines PDF document metadata for declarations that this PDF is compliant with the PDF/A profile.- Specified by:
checkPDFAConformancein interfacePDFAConformanceChecker- 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 thetbsDocand thesignPageis "consistent", meaning that the method will returnfalsethe main document is PDF/A and the added sign page is not, andtrueotherwise- Specified by:
isPDFAConsistentin interfacePDFAConformanceChecker- Parameters:
tbsDoc- the pdf document to be signedsignPage- the sign page added to the document to be signed- Returns:
trueif constistent andfalse 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:
assertPDFAConsistencyin interfacePDFAConformanceChecker- Parameters:
tbsDoc- the pdf document to be signedsignPage- 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
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
-