Class AnnotationValidator

    • Method Detail

      • checkFlags

        protected boolean checkFlags()
        Checks if flags of the annotation are authorized.
        • Print flag must be 1
        • NoView flag must be 0
        • Hidden flag must be 0
        • Invisible flag must be 0
        If one of these flags is invalid, the errors list is updated with the ERROR_ANNOT_FORBIDDEN_FLAG ValidationError code.
        Returns:
        false if a flag is invalid, true otherwise.
      • checkCA

        protected boolean checkCA()
        Check if the CA value is 1.0. Return true if the CA element is missing or if the value is 1.0. Return false otherwise and update the list of errors present in the DocumentHandler.
        Returns:
        true if the CA element is missing or if the value is 1.0.
      • checkColors

        protected boolean checkColors()
                               throws ValidationException
        Return true if the C field is present in the Annotation dictionary and if the RGB profile is used in the DestOutputProfile of the OutputIntent dictionary.
        Returns:
        true if the C field is present and the RGB profile is used.
        Throws:
        ValidationException
      • searchRGBProfile

        protected boolean searchRGBProfile()
                                    throws ValidationException
        Search the RGB Profile in OutputIntents dictionaries
        Returns:
        true if a rgb profile is found, false otherwise.
        Throws:
        ValidationException
      • checkAP

        protected boolean checkAP()
                           throws ValidationException
        This method checks the AP entry of the Annotation Dictionary. If the AP key is missing, this method returns true. If the AP key exists, only the N entry is authorized and must be a Stream which define the appearance of the annotation. (Currently, only the type of the N entry is checked because of the Appearance stream is a Form XObject, so it will be checked by the Graphics Helper) If the AP content isn't valid, this method return false and updates the errors list.
        Returns:
        the validation state of the AP content.
        Throws:
        ValidationException
      • checkActions

        protected boolean checkActions()
                                throws ValidationException
        Extract a list of ActionManager from the Annotation dictionary and valid them. If an action is invalid, the errors list is updated and the method returns false. Otherwise, the method returns true and the errors list doesn't change.
        Returns:
        the validation state of the annotations actions.
        Throws:
        ValidationException
      • checkPopup

        protected boolean checkPopup()
                              throws ValidationException
        This method validates the Popup entry. This entry shall contain an other Annotation. This annotation is validated with the right AnnotationValidator.
        Returns:
        true if the popup entry is valid, false if not.
        Throws:
        ValidationException
      • validate

        public boolean validate()
                         throws ValidationException
        Execute validation of the Annotation dictionary.
        Returns:
        true if validation succeed, false otherwise.
        Throws:
        ValidationException
      • checkMandatoryFields

        protected boolean checkMandatoryFields()
        Checks if all mandatory fields of an annotation are present. If some fields are missing, the method returns false and the errors list is updated.
        Returns:
        true if validation succeed, false otherwise.
      • checkSpecificMandatoryFields

        protected boolean checkSpecificMandatoryFields()
        Override this method to check the presence of specific fields
        Returns:
        the presence of specific fields.
      • setFactory

        public final void setFactory​(AnnotationValidatorFactory fact)
        Initialize the annotFact attribute of this object. This method must be called by the Factory at the creation of this object. Only the Factory should call this method.
        Parameters:
        fact -
      • getFieldType

        private COSBase getFieldType()