Class PdfA4Checker

  • All Implemented Interfaces:
    IValidationChecker

    public class PdfA4Checker
    extends PdfA3Checker
    PdfA4Checker defines the requirements of the PDF/A-4 standard and contains a number of methods that override the implementations of its superclass PdfA3Checker.

    The specification implemented by this class is ISO 19005-4

    • Field Detail

      • CALRGB_COLOR_SPACE

        private static final java.lang.String CALRGB_COLOR_SPACE
        See Also:
        Constant Field Values
      • forbiddenAnnotations4

        private static final java.util.Set<PdfName> forbiddenAnnotations4
      • forbiddenAnnotations4E

        private static final java.util.Set<PdfName> forbiddenAnnotations4E
      • forbiddenAnnotations4F

        private static final java.util.Set<PdfName> forbiddenAnnotations4F
      • apLessAnnotations

        private static final java.util.Set<PdfName> apLessAnnotations
      • allowedBlendModes4

        private static final java.util.Set<PdfName> allowedBlendModes4
      • TRANSPARENCY_ERROR_MESSAGE

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

        private static final org.slf4j.Logger LOGGER
      • forbiddenActionsE

        private static final java.util.Set<PdfName> forbiddenActionsE
      • allowedEntriesInAAWhenNonWidget

        private static final java.util.Set<PdfName> allowedEntriesInAAWhenNonWidget
      • iccBasedCmykObjects

        private java.util.Map<PdfObject,​java.util.List<PdfStream>> iccBasedCmykObjects
    • Constructor Detail

      • PdfA4Checker

        public PdfA4Checker​(PdfAConformance aConformance)
        Creates a PdfA4Checker with the required conformance
        Parameters:
        aConformance - the required conformance
    • Method Detail

      • 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 PdfA2Checker
        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
      • checkFileSpec

        protected void checkFileSpec​(PdfDictionary fileSpec)
        Verify the conformity of the file specification dictionary.
        Overrides:
        checkFileSpec in class PdfA3Checker
        Parameters:
        fileSpec - the PdfDictionary containing file specification to be checked
      • checkCatalogAAConformance

        protected void checkCatalogAAConformance​(PdfDictionary dict)
        Check the conformity of the AA dictionary on catalog level.
        Overrides:
        checkCatalogAAConformance in class PdfA2Checker
        Parameters:
        dict - the catalog dictionary
      • checkPageAAConformance

        protected void checkPageAAConformance​(PdfDictionary dict)
        Check the conformity of the AA dictionary on catalog level.
        Overrides:
        checkPageAAConformance in class PdfA2Checker
        Parameters:
        dict - the catalog dictionary
      • checkCanvasStack

        public void checkCanvasStack​(char stackOperation)
        This method checks compliance with the graphics state architectural limitation, explained by PdfAChecker.maxGsStackDepth.
        Overrides:
        checkCanvasStack in class PdfA1Checker
        Parameters:
        stackOperation - the operation to check the graphics state counter for
      • checkSignatureType

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

        protected int getMaxStringLength()
        Returns maximum allowed bytes length of the string in a PDF document.
        Overrides:
        getMaxStringLength in class PdfA2Checker
        Returns:
        maximum string length
      • 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 PdfA2Checker
        Parameters:
        extGState - the graphics state to be checked
        contentStream - current content stream
      • 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
        Overrides:
        checkFormXObject in class PdfA2Checker
        Parameters:
        form - the PdfStream to be checked
        contentStream - the PdfStream current content stream
      • getForbiddenAnnotations

        protected java.util.Set<PdfName> getForbiddenAnnotations()
        Gets forbidden annotation types.
        Overrides:
        getForbiddenAnnotations in class PdfA2Checker
        Returns:
        a set of forbidden annotation types
      • getAppearanceLessAnnotations

        protected java.util.Set<PdfName> getAppearanceLessAnnotations()
        Gets annotation types which are allowed not to have appearance stream.
        Overrides:
        getAppearanceLessAnnotations in class PdfA2Checker
        Returns:
        set of annotation names.
      • checkWidgetAAConformance

        protected void checkWidgetAAConformance​(PdfDictionary dict)
        Check the conformity of the AA dictionary on widget level.
        Parameters:
        dict - the widget dictionary
      • checkOutputIntents

        protected void checkOutputIntents​(PdfDictionary catalog)
        Verify the conformity of the output intents array in the catalog dictionary.
        Overrides:
        checkOutputIntents in class PdfA2Checker
        Parameters:
        catalog - the PdfDictionary of a catalog or page to check
      • 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.
        Overrides:
        checkAnnotationAgainstActions in class PdfA2Checker
        Parameters:
        annotDic - an annotation PDF dictionary
      • hasAAIllegalEntries

        private static boolean hasAAIllegalEntries​(PdfDictionary aa)
      • getForbiddenActions

        protected java.util.Set<PdfName> getForbiddenActions()
        Retrieve forbidden actions in conforming document.
        Overrides:
        getForbiddenActions in class PdfA2Checker
        Returns:
        set of PdfName with forbidden actions
      • getTransparencyErrorMessage

        protected java.lang.String getTransparencyErrorMessage()
        Retrieve transparency error message valid for the pdf/a standard being used.
        Overrides:
        getTransparencyErrorMessage in class PdfA2Checker
        Returns:
        error message.
      • checkBlendMode

        protected void checkBlendMode​(PdfName blendMode)
        Check if blendMode is compatible with pdf/a standard being used.
        Overrides:
        checkBlendMode in class PdfA2Checker
        Parameters:
        blendMode - blend mode name to check.
      • getMaxNameLength

        protected int getMaxNameLength()
        Retrieve maximum allowed length of the name object.
        Overrides:
        getMaxNameLength in class PdfA1Checker
        Returns:
        maximum allowed length of the name
      • isValidEncoding

        private static void isValidEncoding​(byte[] data)
      • isValidXmpConformance

        private static boolean isValidXmpConformance​(java.lang.String value)
      • isValidXmpRevision

        private static boolean isValidXmpRevision​(java.lang.String value)
      • checkPacketHeader

        private void checkPacketHeader​(byte[] meta)
      • checkFileProvenanceSpec

        private void checkFileProvenanceSpec​(XMPMeta meta)
      • checkVersionIdentification

        private void checkVersionIdentification​(XMPMeta meta)
      • isCMYKColorant

        private boolean isCMYKColorant​(PdfName colourant)
      • checkPageContentsForColorUsages

        private void checkPageContentsForColorUsages​(PdfDictionary pageDict,
                                                     PdfStream pageIntentProfile,
                                                     PdfColorSpace pageTransparencyBlendingCS)
      • checkAnnotationsForColorUsages

        private void checkAnnotationsForColorUsages​(PdfArray annotations,
                                                    PdfStream pageIntentProfile,
                                                    PdfColorSpace pageTransparencyBlendingCS)
      • checkAppearanceStreamForColorUsages

        private void checkAppearanceStreamForColorUsages​(PdfDictionary ap,
                                                         PdfStream pageIntentProfile,
                                                         PdfColorSpace pageTransparencyBlendingCS)
      • checkObjectWithResourcesForColorUsages

        private void checkObjectWithResourcesForColorUsages​(PdfObject objectWithResources,
                                                            PdfStream pageIntentProfile,
                                                            PdfColorSpace pageTransparencyBlendingCS)
      • checkResourcesForColorUsages

        private void checkResourcesForColorUsages​(PdfDictionary resources,
                                                  PdfStream pageIntentProfile,
                                                  PdfColorSpace pageTransparencyBlendingCS)
      • checkSingleResourceTypeForColorUsages

        private void checkSingleResourceTypeForColorUsages​(PdfDictionary singleResourceDict,
                                                           PdfStream pageIntentProfile,
                                                           PdfColorSpace pageTransparencyBlendingCS)
      • checkContentForColorUsages

        private void checkContentForColorUsages​(PdfObject pdfObject,
                                                PdfStream pageIntentProfile,
                                                PdfColorSpace pageTransparencyBlendingCS)
      • throwIfIdenticalProfiles

        private static void throwIfIdenticalProfiles​(PdfStream iccBasedProfile1,
                                                     PdfStream iccBasedProfile2)
      • getColorspaceTypeIfIccBasedOrCalRgb

        private static java.lang.String getColorspaceTypeIfIccBasedOrCalRgb​(PdfColorSpace colorspace)
      • getDeviceIndependentTransparencyBlendingCSIfRbgOrCmykBased

        private static PdfColorSpace getDeviceIndependentTransparencyBlendingCSIfRbgOrCmykBased​(PdfDictionary pageDict)