Package com.itextpdf.forms.xfdf
Class AnnotObject
- java.lang.Object
-
- com.itextpdf.forms.xfdf.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 Summary
Fields Modifier and Type Field Description private ActionObject
action
Represents Action element, a child of OnActivation element of the link annotation.private java.lang.String
appearance
Represents appearance element, a child element of stamp element.private java.util.List<AttributeObject>
attributes
Represents a list of attributes of the annotation.private BorderStyleAltObject
borderStyleAlt
Represents the BorderStyleAlt element, a child of the link element.private PdfString
contents
Represents contents tag in Xfdf document structure.private PdfString
contentsRichText
Represents contents-richtext tag in Xfdf document structure.private java.lang.String
defaultAppearance
Represents the defaultappearance element, a child of the caret and freetext elements.private java.lang.String
defaultStyle
Represents defaultstyle element, a child of the freetext element.private DestObject
destination
Represents Dest element, a child element of link, GoTo, GoToR elements.private boolean
hasPopup
A boolean, indicating if annotation has inner popup element.private java.lang.String
name
Represents the type of annotation.private AnnotObject
popup
Represents a popup annotation, an inner element of the annotation element.private PdfIndirectReference
ref
The reference to the sourcePdfAnnotation
.private java.lang.String
vertices
Represents the string, containing vertices element, a child of the polygon and polyline elements.
-
Constructor Summary
Constructors Constructor Description AnnotObject()
Creates an instance ofAnnotObject
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttribute(AttributeObject attr)
Adds newAttributeObject
to the list of annotation attributes.(package private) void
addAttribute(java.lang.String name, boolean value)
Adds new attribute with given name and boolean value converted to string.(package private) void
addAttribute(java.lang.String name, float value)
(package private) void
addAttribute(java.lang.String name, Rectangle value)
(package private) void
addAttribute(java.lang.String name, PdfObject valueObject)
(package private) void
addAttribute(java.lang.String name, PdfObject valueObject, boolean required)
Adds new attribute by given name and value.(package private) void
addFdfAttributes(int pageNumber)
Adds page, required attribute of every annotation.ActionObject
getAction()
Gets Action element, a child of OnActivation element of the link annotation.java.lang.String
getAppearance()
Gets the string value of the appearance element, a child element of stamp element.AttributeObject
getAttribute(java.lang.String name)
Finds the attribute by name in attributes list.java.util.List<AttributeObject>
getAttributes()
Gets a list of all attributes of the annotation.java.lang.String
getAttributeValue(java.lang.String name)
Finds the attribute by name in attributes list and return its string value.BorderStyleAltObject
getBorderStyleAlt()
Gets the BorderStyleAlt element, a child of the link element.PdfString
getContents()
Gets the string value of contents tag in Xfdf document structure.PdfString
getContentsRichText()
Gets the string value of contents-richtext tag in Xfdf document structure.java.lang.String
getDefaultAppearance()
Gets the string value of the defaultappearance element, a child of the caret and freetext elements.java.lang.String
getDefaultStyle()
Gets the string value of the defaultstyle element, a child of the freetext element.DestObject
getDestination()
Gets Dest element, a child element of link, GoTo, GoToR elements.java.lang.String
getName()
Gets the string value of the type of annotation.AnnotObject
getPopup()
Gets the popup annotation, an inner element of the annotation element.PdfIndirectReference
getRef()
Gets the reference to the sourcePdfAnnotation
.java.lang.String
getVertices()
Gets the string, containing vertices element, a child of the polygon and polyline elements.boolean
isHasPopup()
Gets the boolean, indicating if annotation has an inner popup element.AnnotObject
setAction(ActionObject action)
Sets Action element, a child of OnActivation element of the link annotation.AnnotObject
setAppearance(java.lang.String appearance)
Gets the string value of the appearance element, a child element of stamp element.AnnotObject
setBorderStyleAlt(BorderStyleAltObject borderStyleAlt)
Sets the BorderStyleAlt element, a child of the link element.AnnotObject
setContents(PdfString contents)
Sets the string value of contents tag in Xfdf document structure.AnnotObject
setContentsRichText(PdfString contentsRichRext)
Sets the string value of contents-richtext tag in xfdf document structure.AnnotObject
setDefaultAppearance(java.lang.String defaultAppearance)
Sets the string value of the defaultappearance element, a child of the caret and freetext elements.AnnotObject
setDefaultStyle(java.lang.String defaultStyle)
Sets the string value of the defaultstyle element, a child of the freetext element.AnnotObject
setDestination(DestObject destination)
Sets Dest element, a child element of link, GoTo, GoToR elements.AnnotObject
setHasPopup(boolean hasPopup)
Sets the boolean, indicating if annotation has inner popup element.AnnotObject
setName(java.lang.String name)
Sets the string value of the type of annotation.AnnotObject
setPopup(AnnotObject popup)
Sets the popup annotation, an inner element of the annotation element.AnnotObject
setRef(PdfIndirectReference ref)
Sets the reference to the sourcePdfAnnotation
.AnnotObject
setVertices(java.lang.String vertices)
Sets the string, containing vertices element, a child of the polygon and polyline elements.
-
-
-
Field Detail
-
name
private java.lang.String name
Represents 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
.
-
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.
-
ref
private PdfIndirectReference ref
The reference to the sourcePdfAnnotation
. Used for attaching popups in case of reading data from pdf file.
-
-
Constructor Detail
-
AnnotObject
public AnnotObject()
Creates an instance ofAnnotObject
.
-
-
Method Detail
-
getName
public java.lang.String 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
public AnnotObject setName(java.lang.String name)
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
public java.util.List<AttributeObject> getAttributes()
Gets a list of all attributes of the annotation.- Returns:
list
containing allattribute 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.
-
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 newAttributeObject
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 namevalueObject
-PdfObject
attribute valuerequired
- 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
.
-
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
- innerBorderStyleAlt object
- Returns:
- current
annotation 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
.
-
getRef
public PdfIndirectReference 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
public AnnotObject setRef(PdfIndirectReference ref)
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.
-
-