Class PdfUAChecker

java.lang.Object
com.itextpdf.pdfua.checkers.PdfUAChecker
All Implemented Interfaces:
IValidationChecker
Direct Known Subclasses:
PdfUA1Checker, PdfUA2Checker

public abstract class PdfUAChecker extends Object implements IValidationChecker
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.

  • Field Details

    • EXCEPTION_SUPPLIER

      static final Function<String, PdfException> EXCEPTION_SUPPLIER
    • warnedOnPageFlush

      private boolean warnedOnPageFlush
  • Constructor Details

    • PdfUAChecker

      protected PdfUAChecker()
      Creates new PdfUAChecker instance.
  • Method Details

    • warnOnPageFlush

      public void warnOnPageFlush()
      Logs a warn on page flushing that page flushing is disabled in PDF/UA mode.
    • checkLang

      void checkLang(PdfCatalog catalog)
      Checks that the default natural language for content and text strings is specified using the Lang entry, with a nonempty value, in the document catalog dictionary.
      Parameters:
      catalog - PdfCatalog document catalog dictionary
    • checkViewerPreferences

      void checkViewerPreferences(PdfCatalog catalog)
      Checks that the ViewerPreferences dictionary of the document catalog dictionary is present and contains at least the DisplayDocTitle key with a value of true, as defined in ISO 32000-1:2008, 12.2, Table 150 or ISO 32000-2:2020, Table 147.
      Parameters:
      catalog - PdfCatalog document catalog dictionary
    • checkOCProperties

      void checkOCProperties(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.

      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 stack
      currentBmc - the current BMC
      document - PdfDocument to check
    • checkContentInCanvas

      void checkContentInCanvas(Stack<Tuple2<PdfName, PdfDictionary>> tagStack, PdfDocument document)
      Checks if content is neither marked as Artifact nor tagged as real content.
      Parameters:
      tagStack - tag structure stack
      document - PdfDocument to check
    • checkFonts

      void checkFonts(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.

      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

      abstract void checkNonSymbolicCmapSubtable(TrueTypeFont fontProgram)
      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

      abstract void checkSymbolicCmapSubtable(TrueTypeFont fontProgram)
      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

      void checkText(String str, PdfFont font)
      Checks that embedded fonts define all glyphs referenced for rendering within the conforming file.
      Parameters:
      str - the text to check
      font - the font to check
    • checkOCGNameAndASKey

      private static void checkOCGNameAndASKey(PdfDictionary dict)
    • isInsideArtifact

      private static boolean isInsideArtifact(Stack<Tuple2<PdfName, PdfDictionary>> tagStack)
    • isInsideRealContent

      private static boolean isInsideRealContent(Stack<Tuple2<PdfName, PdfDictionary>> tagStack, PdfDocument document)
    • isRealContent

      private static boolean isRealContent(Tuple2<PdfName, PdfDictionary> tag, PdfDocument document)
    • mcrExists

      private static PdfMcr mcrExists(PdfDocument document, int mcid)
    • checkNonSymbolicTrueTypeFont

      private void checkNonSymbolicTrueTypeFont(PdfTrueTypeFont trueTypeFont)
    • checkSymbolicTrueTypeFont

      private void checkSymbolicTrueTypeFont(PdfTrueTypeFont trueTypeFont)