Class PdfA2Checker

All Implemented Interfaces:
IValidationChecker
Direct Known Subclasses:
PdfA3Checker

public class PdfA2Checker extends PdfA1Checker
PdfA2Checker defines the requirements of the PDF/A-2 standard and contains a number of methods that override the implementations of its superclass PdfA1Checker.

The specification implemented by this class is ISO 19005-2

  • Field Details

    • forbiddenAnnotations

      protected static final Set<PdfName> forbiddenAnnotations
    • apLessAnnotations

      protected static final Set<PdfName> apLessAnnotations
    • forbiddenActions

      protected static final Set<PdfName> forbiddenActions
    • allowedBlendModes

      protected static final Set<PdfName> allowedBlendModes
    • allowedFilters

      protected static final Set<PdfName> allowedFilters
    • allowedInlineImageFilters

      protected static final Set<PdfName> allowedInlineImageFilters
    • transparencyObjects

      protected Set<PdfObject> transparencyObjects
  • Constructor Details

    • PdfA2Checker

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

    • 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.
      Overrides:
      checkInlineImage in class PdfA1Checker
      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 contentStream)
      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
      Overrides:
      checkColor in class PdfA1Checker
      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
      contentStream - current content stream
    • checkColor

      public void checkColor (CanvasGraphicsState gState, Color color, PdfDictionary currentColorSpaces, Boolean fill, PdfStream contentStream)
      This method checks compliance with the color restrictions imposed by the available color spaces in the document.
      Overrides:
      checkColor in class PdfA1Checker
      Parameters:
      gState - 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
      contentStream - 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 PdfA1Checker
      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
    • 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
      Overrides:
      checkExtGState in class PdfA1Checker
      Parameters:
      extGState - the graphics state to be checked
      contentStream - current content stream
    • checkSignature

      public void checkSignature (PdfDictionary signatureDict)
      Description copied from class: PdfAChecker
      This method checks compliance of the signature dictionary
      Overrides:
      checkSignature in class PdfAChecker
      Parameters:
      signatureDict - a PdfDictionary containing the signature.
    • checkNumberOfDeviceNComponents

      protected void checkNumberOfDeviceNComponents (PdfSpecialCs.DeviceN deviceN)
    • checkNonSymbolicTrueTypeFont

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

      protected double getMaxRealValue()
      Description copied from class: PdfA1Checker
      Retrieve maximum allowed real value.
      Overrides:
      getMaxRealValue in class PdfA1Checker
      Returns:
      maximum allowed real number
    • getMaxStringLength

      protected int getMaxStringLength()
      Description copied from class: PdfA1Checker
      Returns maximum allowed bytes length of the string in a PDF document.
      Overrides:
      getMaxStringLength in class PdfA1Checker
      Returns:
      maximum string length
    • checkPdfArray

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

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

      protected void checkAnnotation (PdfDictionary annotDic)
      Verify the conformity of the annotation dictionary.
      Overrides:
      checkAnnotation in class PdfA1Checker
      Parameters:
      annotDic - the annotation PdfDictionary to be checked
    • getAppearanceLessAnnotations

      protected Set<PdfName> getAppearanceLessAnnotations()
      Gets annotation types which are allowed not to have appearance stream.
      Returns:
      set of annotation names.
    • checkAnnotationAgainstActions

      protected void checkAnnotationAgainstActions (PdfDictionary annotDic)
      Checked annotation against actions, exception will be thrown if either A or AA actions aren't allowed for specific type of annotation.
      Parameters:
      annotDic - an annotation PDF dictionary
    • getForbiddenAnnotations

      protected Set<PdfName> getForbiddenAnnotations()
      Gets forbidden annotation types.
      Overrides:
      getForbiddenAnnotations in class PdfA1Checker
      Returns:
      a set of forbidden annotation types
    • checkAppearanceStream

      protected void checkAppearanceStream (PdfStream appearanceStream)
      Description copied from class: PdfAChecker
      Check single annotation appearance stream.
      Overrides:
      checkAppearanceStream in class PdfAChecker
      Parameters:
      appearanceStream - the PdfStream to check
    • checkForm

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

      protected void checkCatalogAAConformance (PdfDictionary dict)
      Checks if the catalog is compliant with the PDF/A-2 standard.
      Parameters:
      dict - the catalog dictionary
    • checkCatalogValidEntries

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

      protected void checkPageSize (PdfDictionary page)
      Description copied from class: PdfAChecker
      Checks the allowable size of the page.
      Overrides:
      checkPageSize in class PdfA1Checker
      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.
      Overrides:
      checkFileSpec in class PdfA1Checker
      Parameters:
      fileSpec - the PdfDictionary containing file specification to be checked
    • checkPdfStream

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

      protected void checkPageAAConformance (PdfDictionary dict)
      Checks if the page is compliant with the PDF/A-2 standard.
      Parameters:
      dict - the page dictionary
    • checkPageObject

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

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

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

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

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

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

      protected void checkImage (PdfStream image, PdfDictionary currentColorSpaces)
      Description copied from class: PdfAChecker
      Verify the conformity of the given image.
      Overrides:
      checkImage in class PdfA1Checker
      Parameters:
      image - the image to check
      currentColorSpaces - the PdfDictionary containing the color spaces used in the document
    • 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
      Overrides:
      checkFontGlyphs in class PdfA1Checker
      Parameters:
      font - PdfFont to be checked
      contentStream - stream containing checked font
    • checkFormXObject

      @Deprecated protected void checkFormXObject (PdfStream form)
      Deprecated.
      For pdf/a-2+ checkers use the checkFormXObject(PdfStream form, PdfStream contentStream) method
      Overrides:
      checkFormXObject in class PdfA1Checker
      Parameters:
      form - the PdfStream to check
    • checkFormXObject

      protected void checkFormXObject (PdfStream form, PdfStream contentStream)
      Verify the conformity of the Form XObject with appropriate specification. Throws PdfAConformanceException if any discrepancy was found
      Parameters:
      form - the PdfStream to be checked
      contentStream - the PdfStream current content stream
    • checkTransparencyGroup

      protected void checkTransparencyGroup (PdfStream form, PdfStream contentStream)
      Verify the conformity of the transparency group XObject with appropriate specification. Throws PdfAConformanceException if any discrepancy was found
      Parameters:
      form - the PdfStream transparency group XObject.
      contentStream - the PdfStream current content stream
    • checkContentConfigurationDictAgainstAsKey

      protected void checkContentConfigurationDictAgainstAsKey (PdfDictionary config)
      Check optional content configuration dictionary against AS key.
      Parameters:
      config - a content configuration dictionary
    • getTransparencyErrorMessage

      protected String getTransparencyErrorMessage()
      Retrieve transparency error message valid for the pdf/a standard being used.
      Returns:
      error message.
    • checkBlendMode

      protected void checkBlendMode (PdfName blendMode)
      Check if blendMode is compatible with pdf/a standard being used.
      Parameters:
      blendMode - blend mode name to check.