Package com.itextpdf.pdfua.checkers
Class PdfUA2Checker
- java.lang.Object
-
- com.itextpdf.pdfua.checkers.PdfUAChecker
-
- com.itextpdf.pdfua.checkers.PdfUA2Checker
-
- All Implemented Interfaces:
IValidationChecker
public class PdfUA2Checker extends PdfUAChecker
The class defines the requirements of the PDF/UA-2 standard and contains method implementations from the abstractPdfUAChecker
class.The specification implemented by this class is ISO 14289-2.
-
-
Field Summary
Fields Modifier and Type Field Description private PdfUAValidationContext
context
private PdfDocument
pdfDocument
private PdfUA2CanvasTextChecker
textChecker
-
Fields inherited from class com.itextpdf.pdfua.checkers.PdfUAChecker
EXCEPTION_SUPPLIER
-
-
Constructor Summary
Constructors Constructor Description PdfUA2Checker(PdfDocument pdfDocument)
CreatesPdfUA2Checker
instance with PDF document which will be validated against PDF/UA-2 standard.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
checkArrayRecursively(PdfArray array)
private void
checkCatalog(PdfCatalog catalog)
Validates document catalog dictionary against PDF/UA-2 standard.private void
checkDictionaryRecursively(PdfDictionary dictionary)
private void
checkFormFieldsAndAnnotations(PdfCatalog catalog)
Validates all annotations and form fields present in the document against PDF/UA-2 standard.protected void
checkMetadata(PdfCatalog catalog)
Checks that theCatalog
dictionary of a conforming file contains theMetadata
key whose value is a metadata stream as defined in ISO 32000-2:2020.(package private) void
checkNonSymbolicCmapSubtable(TrueTypeFont fontProgram)
For all non-symbolic TrueType fonts used for rendering, the embedded TrueType font program shall contain at least the Microsoft Unicode (3, 1 – Platform ID = 3, Encoding ID = 1), or the Macintosh Roman (1, 0 – Platform ID = 1, Encoding ID = 0) “cmap” subtable.private void
checkPdfObject(PdfObject obj)
private void
checkStructureTreeRoot(PdfStructTreeRoot structTreeRoot)
Validates structure tree root dictionary against PDF/UA-2 standard.(package private) void
checkSymbolicCmapSubtable(TrueTypeFont fontProgram)
Checks cmap entries present in the embedded TrueType font program of the symbolic TrueType font.boolean
isPdfObjectReadyToFlush(PdfObject object)
IsPdfObject
ready to flush.void
validate(IValidationContext context)
Validate the providedIValidationContext
.-
Methods inherited from class com.itextpdf.pdfua.checkers.PdfUAChecker
checkContentInCanvas, checkFonts, checkLang, checkLogicalStructureInBMC, checkOCProperties, checkText, checkViewerPreferences, warnOnPageFlush
-
-
-
-
Field Detail
-
pdfDocument
private final PdfDocument pdfDocument
-
context
private final PdfUAValidationContext context
-
textChecker
private final PdfUA2CanvasTextChecker textChecker
-
-
Constructor Detail
-
PdfUA2Checker
public PdfUA2Checker(PdfDocument pdfDocument)
CreatesPdfUA2Checker
instance with PDF document which will be validated against PDF/UA-2 standard.- Parameters:
pdfDocument
- the document to validate
-
-
Method Detail
-
validate
public void validate(IValidationContext context)
Description copied from interface:IValidationChecker
Validate the providedIValidationContext
.- Parameters:
context
- theIValidationContext
to validate
-
isPdfObjectReadyToFlush
public boolean isPdfObjectReadyToFlush(PdfObject object)
Description copied from interface:IValidationChecker
IsPdfObject
ready to flush.- Parameters:
object
- the pdf object to check- Returns:
true
if the object is ready to flush,false
otherwise
-
checkMetadata
protected void checkMetadata(PdfCatalog catalog)
Checks that theCatalog
dictionary of a conforming file contains theMetadata
key whose value is a metadata stream as defined in ISO 32000-2:2020. Also checks that the value ofpdfuaid:part
is 2 for conforming PDF files and validates requiredpdfuaid:rev
value.Checks that the
Metadata
stream as specified in ISO 32000-2:2020, 14.3 in the document catalog dictionary includes adc: title
entry reflecting the title of the document.- Parameters:
catalog
-PdfCatalog
document catalog dictionary
-
checkNonSymbolicCmapSubtable
void checkNonSymbolicCmapSubtable(TrueTypeFont fontProgram)
For all non-symbolic TrueType fonts used for rendering, the embedded TrueType font program shall contain at least the Microsoft Unicode (3, 1 – Platform ID = 3, Encoding ID = 1), or the Macintosh Roman (1, 0 – Platform ID = 1, Encoding ID = 0) “cmap” subtable.- Specified by:
checkNonSymbolicCmapSubtable
in classPdfUAChecker
- Parameters:
fontProgram
- the embedded TrueType font program to check
-
checkSymbolicCmapSubtable
void checkSymbolicCmapSubtable(TrueTypeFont fontProgram)
Checks cmap entries present in the embedded TrueType font program of the symbolic TrueType font.The “cmap” subtable in the embedded font program shall either contain the Microsoft Symbol (3, 0 – Platform ID = 3, Encoding ID = 0) or the Mac Roman (1, 0 – Platform ID = 1, Encoding ID = 1) encoding.
- Specified by:
checkSymbolicCmapSubtable
in classPdfUAChecker
- Parameters:
fontProgram
- the embedded TrueType font program to check
-
checkPdfObject
private void checkPdfObject(PdfObject obj)
-
checkArrayRecursively
private void checkArrayRecursively(PdfArray array)
-
checkDictionaryRecursively
private void checkDictionaryRecursively(PdfDictionary dictionary)
-
checkCatalog
private void checkCatalog(PdfCatalog catalog)
Validates document catalog dictionary against PDF/UA-2 standard.- Parameters:
catalog
-PdfCatalog
document catalog dictionary to check
-
checkFormFieldsAndAnnotations
private void checkFormFieldsAndAnnotations(PdfCatalog catalog)
Validates all annotations and form fields present in the document against PDF/UA-2 standard.- Parameters:
catalog
-PdfCatalog
to check form fields present in the acroform
-
checkStructureTreeRoot
private void checkStructureTreeRoot(PdfStructTreeRoot structTreeRoot)
Validates structure tree root dictionary against PDF/UA-2 standard.Additionally, checks that within a given explicitly provided namespace, structure types are not role mapped to other structure types in the same namespace. In the StructTreeRoot RoleMap there is no explicitly provided namespace, that's why it is not checked.
- Parameters:
structTreeRoot
-PdfStructTreeRoot
structure tree root dictionary to check
-
-