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 Detail

      • forbiddenAnnotations

        protected static final java.util.Set<PdfName> forbiddenAnnotations
      • apLessAnnotations

        protected static final java.util.Set<PdfName> apLessAnnotations
      • forbiddenActions

        protected static final java.util.Set<PdfName> forbiddenActions
      • allowedBlendModes

        protected static final java.util.Set<PdfName> allowedBlendModes
      • allowedFilters

        protected static final java.util.Set<PdfName> allowedFilters
      • allowedInlineImageFilters

        protected static final java.util.Set<PdfName> allowedInlineImageFilters
      • transparencyObjects

        protected java.util.Set<PdfObject> transparencyObjects
      • MAX_NUMBER_OF_DEVICEN_COLOR_COMPONENTS

        private static final int MAX_NUMBER_OF_DEVICEN_COLOR_COMPONENTS
        See Also:
        Constant Field Values
      • logger

        private static final org.slf4j.Logger logger
      • TRANSPARENCY_ERROR_MESSAGE

        private static final java.lang.String TRANSPARENCY_ERROR_MESSAGE
        See Also:
        Constant Field Values
      • currentFillCsIsIccBasedCMYK

        private boolean currentFillCsIsIccBasedCMYK
      • currentStrokeCsIsIccBasedCMYK

        private boolean currentStrokeCsIsIccBasedCMYK
      • separationColorSpaces

        private java.util.Map<PdfName,​PdfArray> separationColorSpaces
    • Constructor Detail

      • 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 Detail

      • 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,
                               java.lang.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,
                               java.lang.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,
                                    java.lang.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
      • checkNumberOfDeviceNComponents

        protected void checkNumberOfDeviceNComponents​(PdfSpecialCs.DeviceN deviceN)
      • 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
      • getAppearanceLessAnnotations

        protected java.util.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 java.util.Set<PdfName> getForbiddenAnnotations()
        Gets forbidden annotation types.
        Overrides:
        getForbiddenAnnotations in class PdfA1Checker
        Returns:
        a set of forbidden annotation types
      • checkCatalogAAConformance

        protected void checkCatalogAAConformance​(PdfDictionary dict)
        Checks if the catalog is compliant with the PDF/A-2 standard.
        Parameters:
        dict - the catalog dictionary
      • 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
      • checkPageAAConformance

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

        private void checkOCProperties​(PdfDictionary oCProperties)
      • 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 java.lang.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.
      • checkContentsForTransparency

        void checkContentsForTransparency​(PdfDictionary pageDict)
      • checkAnnotationsForTransparency

        void checkAnnotationsForTransparency​(PdfArray annotations)
      • checkAppearanceStreamForTransparency

        private void checkAppearanceStreamForTransparency​(PdfDictionary ap,
                                                          java.util.Set<PdfObject> checkedObjects)
      • checkObjectWithResourcesForTransparency

        private void checkObjectWithResourcesForTransparency​(PdfObject objectWithResources,
                                                             java.util.Set<PdfObject> checkedObjects)
      • checkResourcesForTransparency

        void checkResourcesForTransparency​(PdfDictionary resources,
                                           java.util.Set<PdfObject> checkedObjects)
      • checkSingleResourceTypeForTransparency

        private void checkSingleResourceTypeForTransparency​(PdfDictionary singleResourceDict,
                                                            java.util.Set<PdfObject> checkedObjects)
      • checkSeparationInsideDeviceN

        private void checkSeparationInsideDeviceN​(PdfArray separation,
                                                  PdfObject deviceNColorSpace,
                                                  PdfObject deviceNTintTransform)
      • checkSeparationCS

        private void checkSeparationCS​(PdfArray separation)
      • checkCatalogConfig

        private void checkCatalogConfig​(PdfDictionary config,
                                        java.util.HashSet<PdfObject> ocgs,
                                        java.util.HashSet<java.lang.String> names)
      • fillOrderRecursively

        private void fillOrderRecursively​(PdfArray orderArray,
                                          java.util.Set<PdfObject> order)
      • checkDefaultCS

        private boolean checkDefaultCS​(PdfObject pdfObject,
                                       PdfDictionary currentColorSpaces,
                                       java.lang.Boolean fill,
                                       PdfName defaultCsName,
                                       int numOfComponents)
      • checkType3FontGlyphs

        private void checkType3FontGlyphs​(PdfType3Font font,
                                          PdfStream contentStream)