Package com.itextpdf.forms.xfdf
Class AnnotObject
- java.lang.Object
-
- com.itextpdf.forms.xfdf.AnnotObject
-
public class AnnotObject extends java.lang.ObjectRepresents 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 ActionObjectactionRepresents Action element, a child of OnActivation element of the link annotation.private java.lang.StringappearanceRepresents appearance element, a child element of stamp element.private java.util.List<AttributeObject>attributesRepresents a list of attributes of the annotation.private BorderStyleAltObjectborderStyleAltRepresents the BorderStyleAlt element, a child of the link element.private PdfStringcontentsRepresents contents tag in Xfdf document structure.private PdfStringcontentsRichTextRepresents contents-richtext tag in Xfdf document structure.private java.lang.StringdefaultAppearanceRepresents the defaultappearance element, a child of the caret and freetext elements.private java.lang.StringdefaultStyleRepresents defaultstyle element, a child of the freetext element.private DestObjectdestinationRepresents Dest element, a child element of link, GoTo, GoToR elements.private booleanhasPopupA boolean, indicating if annotation has inner popup element.private java.lang.StringnameRepresents the type of annotation.private AnnotObjectpopupRepresents a popup annotation, an inner element of the annotation element.private PdfIndirectReferencerefThe reference to the sourcePdfAnnotation.private java.lang.StringverticesRepresents 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 voidaddAttribute(AttributeObject attr)Adds newAttributeObjectto the list of annotation attributes.(package private) voidaddAttribute(java.lang.String name, boolean value)Adds new attribute with given name and boolean value converted to string.(package private) voidaddAttribute(java.lang.String name, float value)(package private) voidaddAttribute(java.lang.String name, Rectangle value)(package private) voidaddAttribute(java.lang.String name, PdfObject valueObject)(package private) voidaddAttribute(java.lang.String name, PdfObject valueObject, boolean required)Adds new attribute by given name and value.(package private) voidaddFdfAttributes(int pageNumber)Adds page, required attribute of every annotation.ActionObjectgetAction()Gets Action element, a child of OnActivation element of the link annotation.java.lang.StringgetAppearance()Gets the string value of the appearance element, a child element of stamp element.AttributeObjectgetAttribute(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.StringgetAttributeValue(java.lang.String name)Finds the attribute by name in attributes list and return its string value.BorderStyleAltObjectgetBorderStyleAlt()Gets the BorderStyleAlt element, a child of the link element.PdfStringgetContents()Gets the string value of contents tag in Xfdf document structure.PdfStringgetContentsRichText()Gets the string value of contents-richtext tag in Xfdf document structure.java.lang.StringgetDefaultAppearance()Gets the string value of the defaultappearance element, a child of the caret and freetext elements.java.lang.StringgetDefaultStyle()Gets the string value of the defaultstyle element, a child of the freetext element.DestObjectgetDestination()Gets Dest element, a child element of link, GoTo, GoToR elements.java.lang.StringgetName()Gets the string value of the type of annotation.AnnotObjectgetPopup()Gets the popup annotation, an inner element of the annotation element.PdfIndirectReferencegetRef()Gets the reference to the sourcePdfAnnotation.java.lang.StringgetVertices()Gets the string, containing vertices element, a child of the polygon and polyline elements.booleanisHasPopup()Gets the boolean, indicating if annotation has an inner popup element.AnnotObjectsetAction(ActionObject action)Sets Action element, a child of OnActivation element of the link annotation.AnnotObjectsetAppearance(java.lang.String appearance)Gets the string value of the appearance element, a child element of stamp element.AnnotObjectsetBorderStyleAlt(BorderStyleAltObject borderStyleAlt)Sets the BorderStyleAlt element, a child of the link element.AnnotObjectsetContents(PdfString contents)Sets the string value of contents tag in Xfdf document structure.AnnotObjectsetContentsRichText(PdfString contentsRichRext)Sets the string value of contents-richtext tag in xfdf document structure.AnnotObjectsetDefaultAppearance(java.lang.String defaultAppearance)Sets the string value of the defaultappearance element, a child of the caret and freetext elements.AnnotObjectsetDefaultStyle(java.lang.String defaultStyle)Sets the string value of the defaultstyle element, a child of the freetext element.AnnotObjectsetDestination(DestObject destination)Sets Dest element, a child element of link, GoTo, GoToR elements.AnnotObjectsetHasPopup(boolean hasPopup)Sets the boolean, indicating if annotation has inner popup element.AnnotObjectsetName(java.lang.String name)Sets the string value of the type of annotation.AnnotObjectsetPopup(AnnotObject popup)Sets the popup annotation, an inner element of the annotation element.AnnotObjectsetRef(PdfIndirectReference ref)Sets the reference to the sourcePdfAnnotation.AnnotObjectsetVertices(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:
Stringvalue 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-Stringvalue of the type of annotation- Returns:
annotation objectwith set name.
-
getAttributes
public java.util.List<AttributeObject> getAttributes()
Gets a list of all attributes of the annotation.- Returns:
listcontaining allattribute objectsof 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:
AttributeObjectwith 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
AttributeObjectwith 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:
AnnotObjectrepresenting the inner popup annotation.
-
setPopup
public AnnotObject setPopup(AnnotObject popup)
Sets the popup annotation, an inner element of the annotation element.- Parameters:
popup-annotation objectrepresenting 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:
PdfStringvalue 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-stringvalue 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:
PdfStringvalue 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 stringvalue 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 objectof 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 newAttributeObjectto 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-Stringattribute namevalueObject-PdfObjectattribute 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 objectof 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:
Stringvalue 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-Stringvalue 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:
Stringvalue 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-Stringvalue 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:
Stringvalue 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-Stringvalue 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:
Stringvalue 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-Stringvalue 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
PdfIndirectReferenceof 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-PdfIndirectReferenceof the source annotation object- Returns:
- this
AnnotObjectinstance.
-
-