Package com.itextpdf.forms.xfdf
Class AnnotObject
java.lang.Object
com.itextpdf.forms.xfdf.AnnotObject
Represents annotation, a child element of annots tag in Xfdf document structure. For more details see part 6.4 in Xfdf specification.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttribute
(AttributeObject attr) Adds newAttributeObject
to the list of annotation attributes.Gets Action element, a child of OnActivation element of the link annotation.Gets the string value of the appearance element, a child element of stamp element.getAttribute
(String name) Finds the attribute by name in attributes list.Gets a list of all attributes of the annotation.getAttributeValue
(String name) Finds the attribute by name in attributes list and return its string value.Gets the BorderStyleAlt element, a child of the link element.Gets the string value of contents tag in Xfdf document structure.Gets the string value of contents-richtext tag in Xfdf document structure.Gets the string value of the defaultappearance element, a child of the caret and freetext elements.Gets the string value of the defaultstyle element, a child of the freetext element.Gets Dest element, a child element of link, GoTo, GoToR elements.getName()
Gets the string value of the type of annotation.getPopup()
Gets the popup annotation, an inner element of the annotation element.getRef()
Gets the reference to the sourcePdfAnnotation
.Gets the string, containing vertices element, a child of the polygon and polyline elements.boolean
Gets the boolean, indicating if annotation has an inner popup element.setAction
(ActionObject action) Sets Action element, a child of OnActivation element of the link annotation.setAppearance
(String appearance) Gets the string value of the appearance element, a child element of stamp element.setBorderStyleAlt
(BorderStyleAltObject borderStyleAlt) Sets the BorderStyleAlt element, a child of the link element.setContents
(PdfString contents) Sets the string value of contents tag in Xfdf document structure.setContentsRichText
(PdfString contentsRichRext) Sets the string value of contents-richtext tag in xfdf document structure.setDefaultAppearance
(String defaultAppearance) Sets the string value of the defaultappearance element, a child of the caret and freetext elements.setDefaultStyle
(String defaultStyle) Sets the string value of the defaultstyle element, a child of the freetext element.setDestination
(DestObject destination) Sets Dest element, a child element of link, GoTo, GoToR elements.setHasPopup
(boolean hasPopup) Sets the boolean, indicating if annotation has inner popup element.Sets the string value of the type of annotation.setPopup
(AnnotObject popup) Sets the popup annotation, an inner element of the annotation element.Sets the reference to the sourcePdfAnnotation
.setVertices
(String vertices) Sets the string, containing vertices element, a child of the polygon and polyline elements.
-
Constructor Details
-
AnnotObject
public AnnotObject()
-
-
Method Details
-
getName
Gets the string value of the type of annotation. Possible values:XfdfConstants.CARET
,XfdfConstants.CIRCLE
,XfdfConstants.FILEATTACHMENT
,XfdfConstants.FREETEXT
,XfdfConstants.HIGHLIGHT
,XfdfConstants.INK
,XfdfConstants.LINE
,XfdfConstants.POLYGON
,XfdfConstants.POLYLINE
,XfdfConstants.SOUND
,XfdfConstants.SQUARE
,XfdfConstants.SQUIGGLY
,XfdfConstants.STAMP
,XfdfConstants.STRIKEOUT
,XfdfConstants.TEXT
,XfdfConstants.UNDERLINE
.- Returns:
-
String
value of the type of annotation
-
setName
Sets the string value of the type of annotation. Possible values:XfdfConstants.CARET
,XfdfConstants.CIRCLE
,XfdfConstants.FILEATTACHMENT
,XfdfConstants.FREETEXT
,XfdfConstants.HIGHLIGHT
,XfdfConstants.INK
,XfdfConstants.LINE
,XfdfConstants.POLYGON
,XfdfConstants.POLYLINE
,XfdfConstants.SOUND
,XfdfConstants.SQUARE
,XfdfConstants.SQUIGGLY
,XfdfConstants.STAMP
,XfdfConstants.STRIKEOUT
,XfdfConstants.TEXT
,XfdfConstants.UNDERLINE
.- Parameters:
-
name
-String
value of the type of annotation - Returns:
-
annotation object
with set name
-
getAttributes
Gets a list of all attributes of the annotation.- Returns:
-
list
containing allattribute objects
of the annotation
-
getAttribute
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
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
Gets the popup annotation, an inner element of the annotation element.- Returns:
-
AnnotObject
representing the inner popup annotation
-
setPopup
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
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
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
Sets the string value of contents tag in Xfdf document structure.- Parameters:
-
contents
-string
value of inner contents element - Returns:
-
current
annotation object
-
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
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
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
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
Adds newAttributeObject
to the list of annotation attributes.- Parameters:
-
attr
- attribute to be added.
-
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
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
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
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
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
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
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
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
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
Sets the BorderStyleAlt element, a child of the link element. Corresponds to the Border key in the common annotation dictionary.- Parameters:
-
borderStyleAlt
- innerBorderStyleAlt object
- Returns:
-
current
annotation object
-
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
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
Gets the reference to the sourcePdfAnnotation
. Used for attaching popups in case of reading data from pdf file.- Returns:
-
an
PdfIndirectReference
of the source annotation object.
-
setRef
Sets the reference to the sourcePdfAnnotation
. Used for attaching popups in case of reading data from pdf file.- Parameters:
-
ref
-PdfIndirectReference
of the source annotation object. - Returns:
-
this
AnnotObject
instance.
-