Class AnnotObject


  • public class AnnotObject
    extends java.lang.Object
    Represents annotation, a child element of annots tag in Xfdf document structure. For more details see part 6.4 in Xfdf specification.
    • Field Detail

      • attributes

        private java.util.List<AttributeObject> attributes
        Represents a list of attributes of the annotation.
      • contents

        private PdfString contents
        Represents contents tag in Xfdf document structure. Is a child of caret, circle, fileattachment, freetext, highlight, ink, line, polygon, polyline, sound, square, squiggly, stamp, strikeout, text, and underline elements. Corresponds to Contents key in annotation dictionary. Content model: a string or a rich text string. For more details see paragraph 6.5.4 in Xfdf document specification.
      • contentsRichText

        private PdfString contentsRichText
        Represents contents-richtext tag in Xfdf document structure. Is a child of caret, circle, fileattachment, freetext, highlight, ink, line, polygon, polyline, sound, square, squiggly, stamp, strikeout, text, and underline elements. Corresponds to RC key in annotation dictionary. Content model: text string. For more details see paragraph 6.5.5 in Xfdf document specification.
      • hasPopup

        private boolean hasPopup
        A boolean, indicating if annotation has inner popup element.
      • popup

        private AnnotObject popup
        Represents a popup annotation, an inner element of the annotation element.
      • action

        private ActionObject action
        Represents Action element, a child of OnActivation element of the link annotation. Corresponds to the A key in the link annotation dictionary.
      • destination

        private DestObject destination
        Represents Dest element, a child element of link, GoTo, GoToR elements. Corresponds to the Dest key in link annotation dictionary.
      • appearance

        private java.lang.String appearance
        Represents appearance element, a child element of stamp element. Corresponds to the AP key in the annotation dictionary. Content model: Base64 encoded string. For more details see paragraph 6.5.1 in Xfdf document specification.
      • defaultAppearance

        private java.lang.String defaultAppearance
        Represents the defaultappearance element, a child of the caret and freetext elements. Corresponds to the DA key in the free text annotation dictionary. Content model: text string. For more details see paragraph 6.5.7 in Xfdf document specification.
      • defaultStyle

        private java.lang.String defaultStyle
        Represents defaultstyle element, a child of the freetext element. Corresponds to the DS key in the free text annotation dictionary. Content model : a text string. For more details see paragraph 6.5.9 in Xfdf document specification.
      • borderStyleAlt

        private BorderStyleAltObject borderStyleAlt
        Represents the BorderStyleAlt element, a child of the link element. Corresponds to the Border key in the common annotation dictionary. For more details see paragraph 6.5.3 in Xfdf document specification.
      • vertices

        private java.lang.String vertices
        Represents the string, containing vertices element, a child of the polygon and polyline elements. Corresponds to the Vertices key in the polygon or polyline annotation dictionary. For more details see paragraph 6.5.31 in Xfdf document specification.
    • Constructor Detail

      • AnnotObject

        public AnnotObject()
        Creates an instance of AnnotObject.
    • Method Detail

      • getAttributes

        public java.util.List<AttributeObject> getAttributes()
        Gets a list of all attributes of the annotation.
        Returns:
        list containing all attribute objects of the annotation.
      • getAttribute

        public AttributeObject getAttribute​(java.lang.String name)
        Finds the attribute by name in attributes list.
        Parameters:
        name - the name of the attribute to look for
        Returns:
        AttributeObject with the given name, or null, if no object with this name was found.
      • getAttributeValue

        public java.lang.String getAttributeValue​(java.lang.String name)
        Finds the attribute by name in attributes list and return its string value.
        Parameters:
        name - the name of the attribute to look for
        Returns:
        the value of the AttributeObject with the given name, or null, if no object with this name was found.
      • getPopup

        public AnnotObject getPopup()
        Gets the popup annotation, an inner element of the annotation element.
        Returns:
        AnnotObject representing the inner popup annotation.
      • isHasPopup

        public boolean isHasPopup()
        Gets the boolean, indicating if annotation has an inner popup element.
        Returns:
        true if annotation has an inner popup element, false otherwise.
      • setHasPopup

        public AnnotObject setHasPopup​(boolean hasPopup)
        Sets the boolean, indicating if annotation has inner popup element.
        Parameters:
        hasPopup - a boolean indicating if annotation has inner popup element
        Returns:
        current annotation object.
      • getContents

        public PdfString getContents()
        Gets the string value of contents tag in Xfdf document structure. Contents is a child of caret, circle, fileattachment, freetext, highlight, ink, line, polygon, polyline, sound, square, squiggly, stamp, strikeout, text, and underline elements. Corresponds to Contents key in annotation dictionary. Content model: a string or a rich text string. For more details see paragraph 6.5.4 in Xfdf document specification.
        Returns:
        PdfString value of inner contents element of current annotation object.
      • setContents

        public AnnotObject setContents​(PdfString contents)
        Sets the string value of contents tag in Xfdf document structure.
        Parameters:
        contents - string value of inner contents element
        Returns:
        current annotation object.
      • getContentsRichText

        public PdfString getContentsRichText()
        Gets the string value of contents-richtext tag in Xfdf document structure. It is a child of caret, circle, fileattachment, freetext, highlight, ink, line, polygon, polyline, sound, square, squiggly, stamp, strikeout, text, and underline elements. Corresponds to RC key in annotation dictionary. Content model: text string. For more details see paragraph 6.5.5 in Xfdf document specification.
        Returns:
        PdfString value of inner contents-richtext element of current annotation object.
      • setContentsRichText

        public AnnotObject setContentsRichText​(PdfString contentsRichRext)
        Sets the string value of contents-richtext tag in xfdf document structure.
        Parameters:
        contentsRichRext - rich text string value of inner contents-richtext element
        Returns:
        current annotation object.
      • getAction

        public ActionObject getAction()
        Gets Action element, a child of OnActivation element of the link annotation. Corresponds to the A key in the link annotation dictionary.
        Returns:
        inner action object of annotation object.
      • setAction

        public AnnotObject setAction​(ActionObject action)
        Sets Action element, a child of OnActivation element of the link annotation. Corresponds to the A key in the link annotation dictionary.
        Parameters:
        action - action object, an inner element of annotation object
        Returns:
        current annotation object.
      • addAttribute

        public void addAttribute​(AttributeObject attr)
        Adds new AttributeObject to the list of annotation attributes.
        Parameters:
        attr - attribute to be added.
      • addAttribute

        void addAttribute​(java.lang.String name,
                          boolean value)
        Adds new attribute with given name and boolean value converted to string.
      • addAttribute

        void addAttribute​(java.lang.String name,
                          float value)
      • addAttribute

        void addAttribute​(java.lang.String name,
                          Rectangle value)
      • addAttribute

        void addAttribute​(java.lang.String name,
                          PdfObject valueObject,
                          boolean required)
        Adds new attribute by given name and value. If required attribute is present, value of the attribute can't be null.
        Parameters:
        name - String attribute name
        valueObject - PdfObject attribute value
        required - boolean indicating if the attribute is required
      • addAttribute

        void addAttribute​(java.lang.String name,
                          PdfObject valueObject)
      • addFdfAttributes

        void addFdfAttributes​(int pageNumber)
        Adds page, required attribute of every annotation.
      • getDestination

        public DestObject getDestination()
        Gets Dest element, a child element of link, GoTo, GoToR elements. Corresponds to the Dest key in link annotation dictionary.
        Returns:
        inner destination object of annotation object
      • setDestination

        public AnnotObject setDestination​(DestObject destination)
        Sets Dest element, a child element of link, GoTo, GoToR elements. Corresponds to the Dest key in link annotation dictionary.
        Parameters:
        destination - destination object, an inner element of annotation object
        Returns:
        current annotation object.
      • getAppearance

        public java.lang.String getAppearance()
        Gets the string value of the appearance element, a child element of stamp element. Corresponds to the AP key in the annotation dictionary. Content model: Base64 encoded string. For more details see paragraph 6.5.1 in Xfdf document specification.
        Returns:
        String value of inner appearance element.
      • setAppearance

        public AnnotObject setAppearance​(java.lang.String appearance)
        Gets the string value of the appearance element, a child element of stamp element. Corresponds to the AP key in the annotation dictionary. Content model: Base64 encoded string.
        Parameters:
        appearance - String value of inner appearance element of annotation object
        Returns:
        current annotation object.
      • getDefaultAppearance

        public java.lang.String getDefaultAppearance()
        Gets the string value of the defaultappearance element, a child of the caret and freetext elements. Corresponds to the DA key in the free text annotation dictionary. Content model: text string. For more details see paragraph 6.5.7 in Xfdf document specification.
        Returns:
        String value of inner default appearance element.
      • setDefaultAppearance

        public AnnotObject setDefaultAppearance​(java.lang.String defaultAppearance)
        Sets the string value of the defaultappearance element, a child of the caret and freetext elements. Corresponds to the DA key in the free text annotation dictionary. Content model: text string.
        Parameters:
        defaultAppearance - String value of inner defaultappearance element of annotation object
        Returns:
        current annotation object.
      • getDefaultStyle

        public java.lang.String getDefaultStyle()
        Gets the string value of the defaultstyle element, a child of the freetext element. Corresponds to the DS key in the free text annotation dictionary. Content model : a text string. For more details see paragraph 6.5.9 in Xfdf document specification.
        Returns:
        String value of inner defaultstyle element.
      • setDefaultStyle

        public AnnotObject setDefaultStyle​(java.lang.String defaultStyle)
        Sets the string value of the defaultstyle element, a child of the freetext element. Corresponds to the DS key in the free text annotation dictionary. Content model : a text string.
        Parameters:
        defaultStyle - String value of inner defaultstyle element of annotation object
        Returns:
        current annotation object.
      • getBorderStyleAlt

        public BorderStyleAltObject getBorderStyleAlt()
        Gets the BorderStyleAlt element, a child of the link element. Corresponds to the Border key in the common annotation dictionary. For more details see paragraph 6.5.3 in Xfdf document specification.
        Returns:
        inner BorderStyleAlt object.
      • getVertices

        public java.lang.String getVertices()
        Gets the string, containing vertices element, a child of the polygon and polyline elements. Corresponds to the Vertices key in the polygon or polyline annotation dictionary. For more details see paragraph 6.5.31 in Xfdf document specification.
        Returns:
        String value of inner vertices element.
      • setVertices

        public AnnotObject setVertices​(java.lang.String vertices)
        Sets the string, containing vertices element, a child of the polygon and polyline elements. Corresponds to the Vertices key in the polygon or polyline annotation dictionary.
        Parameters:
        vertices - String value of inner vertices element
        Returns:
        current annotation object.