Class PdfA1Checker

java.lang.Object
com.itextpdf.pdfa.checker.PdfAChecker
com.itextpdf.pdfa.checker.PdfA1Checker
All Implemented Interfaces:
IValidationChecker
Direct Known Subclasses:
PdfA2Checker

public class PdfA1Checker extends PdfAChecker
PdfA1Checker defines the requirements of the PDF/A-1 standard and contains method implementations from the abstract PdfAChecker class.

The specification implemented by this class is ISO 19005-1

  • Field Details

    • forbiddenAnnotations

      protected static final Set<PdfName> forbiddenAnnotations
    • contentAnnotations

      protected static final Set<PdfName> contentAnnotations
    • forbiddenActions

      protected static final Set<PdfName> forbiddenActions
    • allowedNamedActions

      protected static final Set<PdfName> allowedNamedActions
    • allowedRenderingIntents

      protected static final Set<PdfName> allowedRenderingIntents
  • Constructor Details

    • PdfA1Checker

      public PdfA1Checker (PdfAConformanceLevel conformanceLevel)
      Creates a PdfA1Checker with the required conformance level
      Parameters:
      conformanceLevel - the required conformance level, a or b
  • Method Details

    • checkCanvasStack

      public void checkCanvasStack (char stackOperation)
      Description copied from class: PdfAChecker
      This method checks compliance with the graphics state architectural limitation, explained by PdfAChecker.maxGsStackDepth.
      Specified by:
      checkCanvasStack in class PdfAChecker
      Parameters:
      stackOperation - the operation to check the graphics state counter for
    • checkInlineImage

      public void checkInlineImage (PdfStream inlineImage, PdfDictionary currentColorSpaces)
      Description copied from class: PdfAChecker
      This method checks compliance with the inline image restrictions in the PDF/A specs, specifically filter parameters.
      Specified by:
      checkInlineImage in class PdfAChecker
      Parameters:
      inlineImage - a PdfStream containing the inline image
      currentColorSpaces - a PdfDictionary containing the color spaces used in the document
    • checkColor

      @Deprecated public void checkColor (Color color, PdfDictionary currentColorSpaces, Boolean fill, PdfStream stream)
      Deprecated.
      This method checks compliance with the color restrictions imposed by the available color spaces in the document. This method will be abstract in update 7.2
      Specified by:
      checkColor in class PdfAChecker
      Parameters:
      color - the color to check
      currentColorSpaces - a PdfDictionary containing the color spaces used in the document
      fill - whether the color is used for fill or stroke operations
      stream - current content stream
    • checkColor

      public void checkColor (CanvasGraphicsState graphicsState, Color color, PdfDictionary currentColorSpaces, Boolean fill, PdfStream stream)
      This method checks compliance with the color restrictions imposed by the available color spaces in the document.
      Overrides:
      checkColor in class PdfAChecker
      Parameters:
      graphicsState - canvas graphics state
      color - the color to check
      currentColorSpaces - a PdfDictionary containing the color spaces used in the document
      fill - whether the color is used for fill or stroke operations
      stream - current content stream
    • checkColorSpace

      public void checkColorSpace (PdfColorSpace colorSpace, PdfObject pdfObject, PdfDictionary currentColorSpaces, boolean checkAlternate, Boolean fill)
      This method performs a range of checks on the given color space, depending on the type and properties of that color space.
      Overrides:
      checkColorSpace in class PdfAChecker
      Parameters:
      colorSpace - the color space to check
      pdfObject - the pdf object to check color space in
      currentColorSpaces - a PdfDictionary containing the color spaces used in the document
      checkAlternate - whether or not to also check the parent color space
      fill - whether the color space is used for fill or stroke operations
    • checkXrefTable

      public void checkXrefTable (PdfXrefTable xrefTable)
      Description copied from class: PdfAChecker
      Verify the conformity of the cross-reference table.
      Specified by:
      checkXrefTable in class PdfAChecker
      Parameters:
      xrefTable - is the Xref table
    • getForbiddenActions

      protected Set<PdfName> getForbiddenActions()
      Description copied from class: PdfAChecker
      Retrieve forbidden actions in conforming document.
      Specified by:
      getForbiddenActions in class PdfAChecker
      Returns:
      set of PdfName with forbidden actions
    • getAllowedNamedActions

      protected Set<PdfName> getAllowedNamedActions()
      Description copied from class: PdfAChecker
      Retrieve allowed actions in conforming document.
      Specified by:
      getAllowedNamedActions in class PdfAChecker
      Returns:
      set of PdfName with allowed named actions
    • getMaxNumberOfIndirectObjects

      protected long getMaxNumberOfIndirectObjects()
      Description copied from class: PdfAChecker
      Retrieve maximum allowed number of indirect objects in conforming document.
      Specified by:
      getMaxNumberOfIndirectObjects in class PdfAChecker
      Returns:
      maximum allowed number of indirect objects
    • checkColorsUsages

      protected void checkColorsUsages()
      Verify the conformity of used color spaces.
      Specified by:
      checkColorsUsages in class PdfAChecker
    • checkPageColorsUsages

      protected void checkPageColorsUsages (PdfDictionary pageDict, PdfDictionary pageResources)
      Verify the conformity of used color spaces on the page.
      Overrides:
      checkPageColorsUsages in class PdfAChecker
      Parameters:
      pageDict - the PdfDictionary contains contents for colors to be checked.
      pageResources - the PdfDictionary contains resources for colors to be checked.
    • checkExtGState

      public void checkExtGState (CanvasGraphicsState extGState, PdfStream contentStream)
      Description copied from class: PdfAChecker
      Performs a number of checks on the graphics state, among others ISO 19005-1 section 6.2.8 and 6.4 and ISO 19005-2 section 6.2.5 and 6.2.10. This method will be abstract in the update 7.2
      Specified by:
      checkExtGState in class PdfAChecker
      Parameters:
      extGState - the graphics state to be checked
      contentStream - current content stream
    • checkFontGlyphs

      public void checkFontGlyphs (PdfFont font, PdfStream contentStream)
      Description copied from class: PdfAChecker
      Performs a check of the each font glyph as a Form XObject. See ISO 19005-2 Annex A.5. This only applies to type 3 fonts. This method will be abstract in update 7.2
      Specified by:
      checkFontGlyphs in class PdfAChecker
      Parameters:
      font - PdfFont to be checked
      contentStream - stream containing checked font
    • checkRenderingIntent

      public void checkRenderingIntent (PdfName intent)
      Description copied from class: PdfAChecker
      Checks whether the rendering intent of the document is within the allowed range of intents. This is defined in ISO 19005-1 section 6.2.9, and unchanged in newer generations of the PDF/A specification.
      Specified by:
      checkRenderingIntent in class PdfAChecker
      Parameters:
      intent - the intent to be analyzed
    • checkFont

      public void checkFont (PdfFont pdfFont)
      Description copied from class: PdfAChecker
      Performs a number of checks on the font. See ISO 19005-1 section 6.3, ISO 19005-2 and ISO 19005-3 section 6.2.11. Be aware that not all constraints defined in the ISO are checked in this method, for most of them we consider that iText always creates valid fonts.
      Specified by:
      checkFont in class PdfAChecker
      Parameters:
      pdfFont - font to be checked
    • checkCrypto

      public void checkCrypto (PdfObject crypto)
      Verify the conformity of encryption usage.
      Overrides:
      checkCrypto in class PdfAChecker
      Parameters:
      crypto - Encryption object to verify.
    • checkSignatureType

      public void checkSignatureType (boolean isCAdES)
      This method checks compliance of the signature type
      Overrides:
      checkSignatureType in class PdfAChecker
      Parameters:
      isCAdES - true is CAdES sig type is used, false otherwise.
    • checkText

      public void checkText (String text, PdfFont font)
      Verify the conformity of the text written by the specified font.
      Overrides:
      checkText in class PdfAChecker
      Parameters:
      text - Text to verify.
      font - Font to verify the text against.
    • checkPageTransparency

      protected void checkPageTransparency (PdfDictionary pageDict, PdfDictionary pageResources)
      Description copied from class: PdfAChecker
      Verify the conformity of the page transparency.
      Specified by:
      checkPageTransparency in class PdfAChecker
      Parameters:
      pageDict - the PdfDictionary contains contents for transparency to be checked
      pageResources - the PdfDictionary contains resources for transparency to be checked
    • checkContentStream

      protected void checkContentStream (PdfStream contentStream)
      Description copied from class: PdfAChecker
      Attest content stream conformance with appropriate specification. Throws PdfAConformanceException if any discrepancy was found
      Specified by:
      checkContentStream in class PdfAChecker
      Parameters:
      contentStream - is a content stream to validate
    • checkNonSymbolicTrueTypeFont

      protected void checkNonSymbolicTrueTypeFont (PdfTrueTypeFont trueTypeFont)
      Description copied from class: PdfAChecker
      Verify the conformity of the non-symbolic TrueType font.
      Specified by:
      checkNonSymbolicTrueTypeFont in class PdfAChecker
      Parameters:
      trueTypeFont - the PdfTrueTypeFont to check
    • checkSymbolicTrueTypeFont

      protected void checkSymbolicTrueTypeFont (PdfTrueTypeFont trueTypeFont)
      Description copied from class: PdfAChecker
      Verify the conformity of the symbolic TrueType font.
      Specified by:
      checkSymbolicTrueTypeFont in class PdfAChecker
      Parameters:
      trueTypeFont - the PdfTrueTypeFont to check
    • checkImage

      protected void checkImage (PdfStream image, PdfDictionary currentColorSpaces)
      Description copied from class: PdfAChecker
      Verify the conformity of the given image.
      Specified by:
      checkImage in class PdfAChecker
      Parameters:
      image - the image to check
      currentColorSpaces - the PdfDictionary containing the color spaces used in the document
    • checkFormXObject

      protected void checkFormXObject (PdfStream form)
      Description copied from class: PdfAChecker
      Verify the conformity of the form XObject dictionary.
      Specified by:
      checkFormXObject in class PdfAChecker
      Parameters:
      form - the PdfStream to check
    • checkLogicalStructure

      protected void checkLogicalStructure (PdfDictionary catalog)
      Description copied from class: PdfAChecker
      Performs a number of checks on the logical structure of the document.
      Specified by:
      checkLogicalStructure in class PdfAChecker
      Parameters:
      catalog - the catalog PdfDictionary to check
    • checkMetaData

      protected void checkMetaData (PdfDictionary catalog)
      Description copied from class: PdfAChecker
      Performs a number of checks on the metadata of the document.
      Specified by:
      checkMetaData in class PdfAChecker
      Parameters:
      catalog - the catalog PdfDictionary to check
    • checkOutputIntents

      protected void checkOutputIntents (PdfDictionary catalog)
      Description copied from class: PdfAChecker
      Verify the conformity of the output intents array in the catalog dictionary.
      Specified by:
      checkOutputIntents in class PdfAChecker
      Parameters:
      catalog - the PdfDictionary of a catalog or page to check
    • checkPdfNumber

      protected void checkPdfNumber (PdfNumber number)
      Description copied from class: PdfAChecker
      Verify the conformity of the PDF number.
      Specified by:
      checkPdfNumber in class PdfAChecker
      Parameters:
      number - the PdfNumber to check
    • getMaxRealValue

      protected double getMaxRealValue()
      Retrieve maximum allowed real value.
      Returns:
      maximum allowed real number
    • getMaxIntegerValue

      protected long getMaxIntegerValue()
      Retrieve maximal allowed integer value.
      Returns:
      maximal allowed integer number
    • getMinIntegerValue

      protected long getMinIntegerValue()
      Retrieve minimal allowed integer value.
      Returns:
      minimal allowed integer number
    • checkPdfArray

      protected void checkPdfArray (PdfArray array)
      Description copied from class: PdfAChecker
      Verify the conformity of the PDF array.
      Specified by:
      checkPdfArray in class PdfAChecker
      Parameters:
      array - the PdfArray to check
    • checkPdfDictionary

      protected void checkPdfDictionary (PdfDictionary dictionary)
      Description copied from class: PdfAChecker
      Verify the conformity of the PDF dictionary.
      Specified by:
      checkPdfDictionary in class PdfAChecker
      Parameters:
      dictionary - the PdfDictionary to check
    • checkPdfStream

      protected void checkPdfStream (PdfStream stream)
      Description copied from class: PdfAChecker
      Verify the conformity of the PDF stream.
      Specified by:
      checkPdfStream in class PdfAChecker
      Parameters:
      stream - the PdfStream to check
    • checkPdfName

      protected void checkPdfName (PdfName name)
      Description copied from class: PdfAChecker
      Verify the conformity of the PDF name.
      Specified by:
      checkPdfName in class PdfAChecker
      Parameters:
      name - the PdfName to check
    • getMaxNameLength

      protected int getMaxNameLength()
      Retrieve maximum allowed length of the name object.
      Returns:
      maximum allowed length of the name
    • checkPdfString

      protected void checkPdfString (PdfString string)
      Description copied from class: PdfAChecker
      Verify the conformity of the PDF string.
      Specified by:
      checkPdfString in class PdfAChecker
      Parameters:
      string - the PdfString to check
    • getMaxStringLength

      protected int getMaxStringLength()
      Returns maximum allowed bytes length of the string in a PDF document.
      Returns:
      maximum string length
    • checkPageSize

      protected void checkPageSize (PdfDictionary page)
      Description copied from class: PdfAChecker
      Checks the allowable size of the page.
      Specified by:
      checkPageSize in class PdfAChecker
      Parameters:
      page - the PdfDictionary of page which size being checked
    • checkFileSpec

      protected void checkFileSpec (PdfDictionary fileSpec)
      Description copied from class: PdfAChecker
      Verify the conformity of the file specification dictionary.
      Specified by:
      checkFileSpec in class PdfAChecker
      Parameters:
      fileSpec - the PdfDictionary containing file specification to be checked
    • checkAnnotation

      protected void checkAnnotation (PdfDictionary annotDic)
      Verify the conformity of the annotation dictionary.
      Specified by:
      checkAnnotation in class PdfAChecker
      Parameters:
      annotDic - the annotation PdfDictionary to be checked
    • getForbiddenAnnotations

      protected Set<PdfName> getForbiddenAnnotations()
      Gets forbidden annotation types.
      Returns:
      a set of forbidden annotation types
    • checkForm

      protected void checkForm (PdfDictionary form)
      Description copied from class: PdfAChecker
      Verify the conformity of the form dictionary.
      Specified by:
      checkForm in class PdfAChecker
      Parameters:
      form - the form PdfDictionary to be checked
    • checkAction

      protected void checkAction (PdfDictionary action)
      Description copied from class: PdfAChecker
      Checks if the action is allowed.
      Specified by:
      checkAction in class PdfAChecker
      Parameters:
      action - to be checked
    • checkCatalog

      protected void checkCatalog (PdfCatalog catalog)
      Verify the conformity of the pdf catalog.
      Overrides:
      checkCatalog in class PdfAChecker
      Parameters:
      catalog - the PdfCatalog of trailer to check.
    • checkCatalogValidEntries

      protected void checkCatalogValidEntries (PdfDictionary catalogDict)
      Description copied from class: PdfAChecker
      Checks if entries in catalog dictionary are valid.
      Specified by:
      checkCatalogValidEntries in class PdfAChecker
      Parameters:
      catalogDict - the catalog PdfDictionary to be checked
    • checkPageObject

      protected void checkPageObject (PdfDictionary pageDict, PdfDictionary pageResources)
      Description copied from class: PdfAChecker
      Verify the conformity of the page dictionary.
      Specified by:
      checkPageObject in class PdfAChecker
      Parameters:
      pageDict - the PdfDictionary to check
      pageResources - the page's resources dictionary
    • checkTrailer

      protected void checkTrailer (PdfDictionary trailer)
      Description copied from class: PdfAChecker
      Verify the conformity of the trailer dictionary.
      Specified by:
      checkTrailer in class PdfAChecker
      Parameters:
      trailer - the PdfDictionary of trailer to check
    • getFormFields

      protected PdfArray getFormFields (PdfArray array)
      Gets a PdfArray of fields with kids from a PdfArray of PdfDictionary objects.
      Parameters:
      array - the PdfArray of form fields PdfDictionary objects
      Returns:
      the PdfArray of form fields