Class AnnotObject

java.lang.Object
com.itextpdf.forms.xfdf.AnnotObject

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

    • AnnotObject

      public AnnotObject()
  • Method Details

    • getName

      public String getName()
      Returns:
      String value of the type of annotation
    • setName

      public AnnotObject setName (String name)
      Parameters:
      name - String value of the type of annotation
      Returns:
      annotation object with set name
    • getAttributes

      public 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 (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 String getAttributeValue (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
    • setPopup

      public AnnotObject setPopup (AnnotObject popup)
      Sets the popup annotation, an inner element of the annotation element.
      Parameters:
      popup - annotation object representing inner popup annotation
      Returns:
      current annotation object
    • 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.
    • 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 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 (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 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 deafultappearance element
    • setDefaultAppearance

      public AnnotObject setDefaultAppearance (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 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 (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
    • setBorderStyleAlt

      public AnnotObject setBorderStyleAlt (BorderStyleAltObject borderStyleAlt)
      Sets the BorderStyleAlt element, a child of the link element. Corresponds to the Border key in the common annotation dictionary.
      Parameters:
      borderStyleAlt - inner BorderStyleAlt object
      Returns:
      current annotation object
    • getVertices

      public 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 (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
    • getRef

      public PdfIndirectReference getRef()
      Gets the reference to the source PdfAnnotation. Used for attaching popups in case of reading data from pdf file.
      Returns:
      an PdfIndirectReference of the source annotation object.
    • setRef

      public AnnotObject setRef (PdfIndirectReference ref)
      Sets the reference to the source PdfAnnotation. Used for attaching popups in case of reading data from pdf file.
      Parameters:
      ref - PdfIndirectReference of the source annotation object.
      Returns:
      this AnnotObject instance.