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

      • forbiddenAnnotations

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

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

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

        protected static final java.util.Set<PdfName> allowedNamedActions
      • allowedRenderingIntents

        protected static final java.util.Set<PdfName> allowedRenderingIntents
      • 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
    • Constructor Detail

      • PdfA1Checker

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

      • 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,
                               java.lang.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,
                               java.lang.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,
                                    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 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 java.util.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
      • 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
      • 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​(java.lang.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.
      • 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
      • 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
      • 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
      • 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
      • getMaxNameLength

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

        protected int getMaxStringLength()
        Returns maximum allowed bytes length of the string in a PDF document.
        Returns:
        maximum string length
      • 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
      • getForbiddenAnnotations

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

        private int getMaxArrayCapacity()
      • getMaxDictionaryCapacity

        private int getMaxDictionaryCapacity()