Class PdfUAChecker
java.lang.Object
com.itextpdf.pdfua.checkers.PdfUAChecker
- All Implemented Interfaces:
IValidationChecker
- Direct Known Subclasses:
PdfUA1Checker, PdfUA2Checker
An abstract class that will run through all necessary checks defined in the different PDF/UA standards. A number of
common checks are executed in this class, while standard-dependent specifications are implemented in the available
subclasses. The standard that is followed is the series of ISO 14289 specifications, currently generations 1 and 2.
While it is possible to subclass this method and implement its abstract methods in client code, this is not encouraged and will have little effect. It is not possible to plug custom implementations into iText, because iText should always refuse to create non-compliant PDF/UA, which would be possible with client code implementations. Any future generations of the PDF/UA standard and its derivatives will get their own implementation in the iText - pdfua project.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final Function<String, PdfException> private boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidcheckContentInCanvas(Stack<Tuple2<PdfName, PdfDictionary>> tagStack, PdfDocument document) Checks if content is neither marked as Artifact nor tagged as real content.(package private) voidcheckFonts(Collection<PdfFont> fontsInDocument) Checks that font programs for all fonts used for rendering within a conforming file, as determined by whether at least one of its glyphs is referenced from one or more content streams, are embedded within that file, as defined in ISO 32000-2:2020, 9.9 and ISO 32000-1:2008, 9.9.(package private) voidcheckLang(PdfCatalog catalog) Checks that the default natural language for content and text strings is specified using theLangentry, with a nonempty value, in the document catalog dictionary.(package private) voidcheckLogicalStructureInBMC(Stack<Tuple2<PdfName, PdfDictionary>> stack, Tuple2<PdfName, PdfDictionary> currentBmc, PdfDocument document) Checks if content marked as Artifact resides in Artifact content, but real content does not.(package private) abstract voidcheckNonSymbolicCmapSubtable(TrueTypeFont fontProgram) Checks cmap entries present in the embedded TrueType font program of the non-symbolic TrueType font.private voidcheckNonSymbolicTrueTypeFont(PdfTrueTypeFont trueTypeFont) private static void(package private) voidcheckOCProperties(PdfDictionary ocProperties) Checks that all optional content configuration dictionaries in the file, including the default one, shall contain a Name entry (see ISO 32000-2:2020, Table 96, or ISO 32000-1:2008, 8.11.2.1, Table 98) whose value is a non-empty text string when document contains a Configs entry in the OCProperties entry of the document catalog dictionary (see ISO 32000-2:2020, Table 29, or ISO 32000-1:2008, 7.7.2, Table 28), and the Configs entry contains at least one optional content configuration dictionary.(package private) abstract voidcheckSymbolicCmapSubtable(TrueTypeFont fontProgram) Checks cmap entries present in the embedded TrueType font program of the symbolic TrueType font.private voidcheckSymbolicTrueTypeFont(PdfTrueTypeFont trueTypeFont) (package private) voidChecks that embedded fonts define all glyphs referenced for rendering within the conforming file.(package private) voidcheckViewerPreferences(PdfCatalog catalog) Checks that theViewerPreferencesdictionary of the document catalog dictionary is present and contains at least theDisplayDocTitlekey with a value oftrue, as defined in ISO 32000-1:2008, 12.2, Table 150 or ISO 32000-2:2020, Table 147.private static booleanisInsideArtifact(Stack<Tuple2<PdfName, PdfDictionary>> tagStack) private static booleanisInsideRealContent(Stack<Tuple2<PdfName, PdfDictionary>> tagStack, PdfDocument document) private static booleanisRealContent(Tuple2<PdfName, PdfDictionary> tag, PdfDocument document) private static PdfMcrmcrExists(PdfDocument document, int mcid) voidLogs a warn on page flushing that page flushing is disabled in PDF/UA mode.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IValidationChecker
isPdfObjectReadyToFlush, validate
-
Field Details
-
EXCEPTION_SUPPLIER
-
warnedOnPageFlush
private boolean warnedOnPageFlush
-
-
Constructor Details
-
PdfUAChecker
protected PdfUAChecker()Creates newPdfUACheckerinstance.
-
-
Method Details
-
warnOnPageFlush
public void warnOnPageFlush()Logs a warn on page flushing that page flushing is disabled in PDF/UA mode. -
checkLang
Checks that the default natural language for content and text strings is specified using theLangentry, with a nonempty value, in the document catalog dictionary.- Parameters:
catalog-PdfCatalogdocument catalog dictionary
-
checkViewerPreferences
Checks that theViewerPreferencesdictionary of the document catalog dictionary is present and contains at least theDisplayDocTitlekey with a value oftrue, as defined in ISO 32000-1:2008, 12.2, Table 150 or ISO 32000-2:2020, Table 147.- Parameters:
catalog-PdfCatalogdocument catalog dictionary
-
checkOCProperties
Checks that all optional content configuration dictionaries in the file, including the default one, shall contain a Name entry (see ISO 32000-2:2020, Table 96, or ISO 32000-1:2008, 8.11.2.1, Table 98) whose value is a non-empty text string when document contains a Configs entry in the OCProperties entry of the document catalog dictionary (see ISO 32000-2:2020, Table 29, or ISO 32000-1:2008, 7.7.2, Table 28), and the Configs entry contains at least one optional content configuration dictionary.Also checks that the AS key does not appear in any optional content configuration dictionary.
- Parameters:
ocProperties- OCProperties entry of the Catalog dictionary
-
checkLogicalStructureInBMC
void checkLogicalStructureInBMC(Stack<Tuple2<PdfName, PdfDictionary>> stack, Tuple2<PdfName, PdfDictionary> currentBmc, PdfDocument document) Checks if content marked as Artifact resides in Artifact content, but real content does not.- Parameters:
stack- the tag structure stackcurrentBmc- the current BMCdocument-PdfDocumentto check
-
checkContentInCanvas
Checks if content is neither marked as Artifact nor tagged as real content.- Parameters:
tagStack- tag structure stackdocument-PdfDocumentto check
-
checkFonts
Checks that font programs for all fonts used for rendering within a conforming file, as determined by whether at least one of its glyphs is referenced from one or more content streams, are embedded within that file, as defined in ISO 32000-2:2020, 9.9 and ISO 32000-1:2008, 9.9.Checks character encodings rules as defined in ISO 14289-2, 8.4.5.7 and ISO 14289-1, 7.21.6.
- Parameters:
fontsInDocument- collection of fonts used in the document
-
checkNonSymbolicCmapSubtable
Checks cmap entries present in the embedded TrueType font program of the non-symbolic TrueType font.- Parameters:
fontProgram- the embedded TrueType font program to check
-
checkSymbolicCmapSubtable
Checks cmap entries present in the embedded TrueType font program of the symbolic TrueType font.- Parameters:
fontProgram- the embedded TrueType font program to check
-
checkText
-
checkOCGNameAndASKey
-
isInsideArtifact
-
isInsideRealContent
private static boolean isInsideRealContent(Stack<Tuple2<PdfName, PdfDictionary>> tagStack, PdfDocument document) -
isRealContent
-
mcrExists
-
checkNonSymbolicTrueTypeFont
-
checkSymbolicTrueTypeFont
-