Class Pdf20Checker

java.lang.Object
com.itextpdf.kernel.validation.Pdf20Checker
All Implemented Interfaces:
IValidationChecker

public class Pdf20Checker extends Object implements IValidationChecker
Class that will run through all necessary checks defined in the PDF 2.0 standard. The standard that is followed is the series of ISO 32000 specifications, starting from ISO 32000-2:2020.
  • Field Details

  • Constructor Details

    • Pdf20Checker

      public Pdf20Checker(PdfDocument pdfDocument)
      Creates new Pdf20Checker instance to validate PDF document against PDF 2.0 standard.
      Parameters:
      pdfDocument - PdfDocument to check
  • Method Details

    • validate

      public void validate(IValidationContext validationContext)
      Description copied from interface: IValidationChecker
      Validate the provided IValidationContext.
      Specified by:
      validate in interface IValidationChecker
      Parameters:
      validationContext - the IValidationContext to validate
    • isPdfObjectReadyToFlush

      public boolean isPdfObjectReadyToFlush(PdfObject object)
      Description copied from interface: IValidationChecker
      Is PdfObject ready to flush.
      Specified by:
      isPdfObjectReadyToFlush in interface IValidationChecker
      Parameters:
      object - the pdf object to check
      Returns:
      true if the object is ready to flush, false otherwise
    • checkLang

      void checkLang(PdfCatalog catalog)
      Checks that natural language is declared using the methods described in ISO 32000-2:2020, 14.9.2.
      Parameters:
      catalog - PdfCatalog document catalog dictionary
    • checkMetadata

      void checkMetadata(PdfCatalog catalog)
      Checks that the value of the Metadata key from the Catalog dictionary of a conforming file is a metadata stream as defined in ISO 32000-2:2020.
      Parameters:
      catalog - PdfCatalog document catalog dictionary
    • checkStructureTreeRoot

      void checkStructureTreeRoot(PdfStructTreeRoot structTreeRoot)
      Validates document structure tree root dictionary against PDF 2.0 standard.

      Checks, that all structure elements are belong to, or role mapped to (such role mapping may be transitive through other namespaces), at least one of the following namespaces specified in ISO 32000-2:2020, 14.8.6: — the PDF 1.7 namespace; — the PDF 2.0 namespace; — the MathML namespace. A structure element with no explicit namespace may be present. Such a structure element shall have, after any role mapping, a structure type matching one of the unique PDF 1.7 element types (the default standard structure namespace in ISO 32000-2 is defined as the PDF 1.7 namespace).

      Parameters:
      structTreeRoot - PdfStructTreeRoot to validate
    • checkCatalog

      private void checkCatalog(PdfCatalog catalog)
      Validates document catalog dictionary against PDF 2.0 standard.

      For now, only Metadata and Lang are checked.

      Parameters:
      catalog - PdfCatalog document catalog dictionary to check