Package com.itextpdf.kernel.pdf.annot
Class PdfFreeTextAnnotation
- java.lang.Object
-
- com.itextpdf.kernel.pdf.PdfObjectWrapper<PdfDictionary>
-
- com.itextpdf.kernel.pdf.annot.PdfAnnotation
-
- com.itextpdf.kernel.pdf.annot.PdfMarkupAnnotation
-
- com.itextpdf.kernel.pdf.annot.PdfFreeTextAnnotation
-
public class PdfFreeTextAnnotation extends PdfMarkupAnnotation
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.itextpdf.kernel.pdf.annot.PdfAnnotation
PdfAnnotation.PdfUnknownAnnotation
-
-
Field Summary
Fields Modifier and Type Field Description static int
CENTERED
static int
LEFT_JUSTIFIED
Text justification options.static int
RIGHT_JUSTIFIED
-
Fields inherited from class com.itextpdf.kernel.pdf.annot.PdfMarkupAnnotation
inReplyTo, popup
-
Fields inherited from class com.itextpdf.kernel.pdf.annot.PdfAnnotation
Accepted, Canceled, Completed, HIDDEN, HIGHLIGHT_INVERT, HIGHLIGHT_NONE, HIGHLIGHT_OUTLINE, HIGHLIGHT_PUSH, HIGHLIGHT_TOGGLE, INVISIBLE, LOCKED, LOCKED_CONTENTS, Marked, MarkedModel, NO_ROTATE, NO_VIEW, NO_ZOOM, None, page, PRINT, READ_ONLY, Rejected, ReviewModel, STYLE_BEVELED, STYLE_DASHED, STYLE_INSET, STYLE_SOLID, STYLE_UNDERLINE, TOGGLE_NO_VIEW, Unmarked
-
-
Constructor Summary
Constructors Modifier Constructor Description PdfFreeTextAnnotation(Rectangle rect, PdfString contents)
Creates new instanceprotected
PdfFreeTextAnnotation(PdfDictionary pdfObject)
Instantiates a newPdfFreeTextAnnotation
instance based onPdfDictionary
instance, that represents existing annotation object in the document.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PdfDictionary
getBorderEffect()
A border effect dictionary that specifies an effect that shall be applied to the border of the annotations.PdfDictionary
getBorderStyle()
The dictionaries for some annotation types (such as free text and polygon annotations) can include the BS entry.PdfArray
getCalloutLine()
PdfString
getDefaultAppearance()
The default appearance string that shall be used in formatting the text.PdfString
getDefaultStyleString()
int
getJustification()
A code specifying the form of quadding (justification) that is used in displaying the annotation's text: 0 - Left-justified, 1 - Centered, 2 - Right-justified.PdfName
getLineEndingStyle()
PdfArray
getRectangleDifferences()
A set of four numbers describing the numerical differences between two rectangles: the Rect entry of the annotation and the inner rectangle where the annotation's text should be displayedPdfNumber
getRotation()
Gets the rotation angle in degrees.PdfName
getSubtype()
Gets aPdfName
which value is a subtype of this annotation.PdfFreeTextAnnotation
setBorderEffect(PdfDictionary borderEffect)
Sets a border effect dictionary that specifies an effect that shall be applied to the border of the annotations.PdfFreeTextAnnotation
setBorderStyle(PdfDictionary borderStyle)
Sets border style dictionary that has more settings than the array specified for the Border entry (PdfAnnotation.getBorder()
).PdfFreeTextAnnotation
setBorderStyle(PdfName style)
Setter for the annotation's preset border style.PdfFreeTextAnnotation
setCalloutLine(float[] calloutLine)
PdfFreeTextAnnotation
setCalloutLine(PdfArray calloutLine)
PdfFreeTextAnnotation
setDashPattern(PdfArray dashPattern)
Setter for the annotation's preset dashed border style.PdfFreeTextAnnotation
setDefaultAppearance(AnnotationDefaultAppearance da)
PdfFreeTextAnnotation
setDefaultAppearance(PdfString appearanceString)
The default appearance string that shall be used in formatting the text.PdfFreeTextAnnotation
setDefaultStyleString(PdfString defaultStyleString)
PdfFreeTextAnnotation
setJustification(int justification)
A code specifying the form of quadding (justification) that is used in displaying the annotation's text: 0 - Left-justified, 1 - Centered, 2 - Right-justified.PdfFreeTextAnnotation
setLineEndingStyle(PdfName lineEndingStyle)
PdfFreeTextAnnotation
setRectangleDifferences(PdfArray rect)
A set of four numbers describing the numerical differences between two rectangles: the Rect entry of the annotation and the inner rectangle where the annotation's text should be displayedPdfFreeTextAnnotation
setRotation(int degAngle)
Sets the rotation angle in degrees.-
Methods inherited from class com.itextpdf.kernel.pdf.annot.PdfMarkupAnnotation
getCreationDate, getExternalData, getInReplyTo, getInReplyToObject, getIntent, getOpacity, getPopup, getPopupObject, getReplyType, getRichText, getSubject, getText, setCreationDate, setExternalData, setInReplyTo, setIntent, setOpacity, setPopup, setReplyType, setRichText, setSubject, setText
-
Methods inherited from class com.itextpdf.kernel.pdf.annot.PdfAnnotation
addAssociatedFile, flush, getAppearanceDictionary, getAppearanceObject, getAppearanceState, getAssociatedFiles, getBlendMode, getBorder, getColorObject, getContents, getDate, getDownAppearanceObject, getFlags, getLang, getName, getNonStrokingOpacity, getNormalAppearanceObject, getPage, getPageObject, getRectangle, getRolloverAppearanceObject, getStrokingOpacity, getStructParentIndex, getTitle, hasFlag, isWrappedObjectMustBeIndirect, makeAnnotation, put, remove, resetFlag, setAppearance, setAppearance, setAppearanceState, setBlendMode, setBorder, setBorder, setColor, setColor, setColor, setContents, setContents, setDate, setDownAppearance, setDownAppearance, setFlag, setFlags, setLang, setLayer, setName, setNonStrokingOpacity, setNormalAppearance, setNormalAppearance, setPage, setRectangle, setRolloverAppearance, setRolloverAppearance, setStrokingOpacity, setStructParentIndex, setTitle
-
Methods inherited from class com.itextpdf.kernel.pdf.PdfObjectWrapper
ensureObjectIsAddedToDocument, ensureUnderlyingObjectHasIndirectReference, getPdfObject, isFlushed, makeIndirect, makeIndirect, markObjectAsIndirect, setForbidRelease, setModified, setPdfObject, unsetForbidRelease
-
-
-
-
Field Detail
-
LEFT_JUSTIFIED
public static final int LEFT_JUSTIFIED
Text justification options.- See Also:
- Constant Field Values
-
CENTERED
public static final int CENTERED
- See Also:
- Constant Field Values
-
RIGHT_JUSTIFIED
public static final int RIGHT_JUSTIFIED
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PdfFreeTextAnnotation
public PdfFreeTextAnnotation(Rectangle rect, PdfString contents)
Creates new instance- Parameters:
rect
- - rectangle that specifies annotation position and bounds on pagecontents
- - the displayed text
-
PdfFreeTextAnnotation
protected PdfFreeTextAnnotation(PdfDictionary pdfObject)
Instantiates a newPdfFreeTextAnnotation
instance based onPdfDictionary
instance, that represents existing annotation object in the document.- Parameters:
pdfObject
- thePdfDictionary
representing annotation object- See Also:
PdfAnnotation.makeAnnotation(PdfObject)
-
-
Method Detail
-
getSubtype
public PdfName getSubtype()
Description copied from class:PdfAnnotation
Gets aPdfName
which value is a subtype of this annotation. See ISO-320001 12.5.6, "Annotation Types" for the reference to the possible types.- Specified by:
getSubtype
in classPdfAnnotation
- Returns:
- subtype of this annotation.
-
getDefaultStyleString
public PdfString getDefaultStyleString()
-
setDefaultStyleString
public PdfFreeTextAnnotation setDefaultStyleString(PdfString defaultStyleString)
-
getDefaultAppearance
public PdfString getDefaultAppearance()
The default appearance string that shall be used in formatting the text. See ISO-32001 12.7.3.3, "Variable Text".- Returns:
- a
PdfString
that specifies the default appearance, or null if default appereance is not specified.
-
setDefaultAppearance
public PdfFreeTextAnnotation setDefaultAppearance(PdfString appearanceString)
The default appearance string that shall be used in formatting the text. See ISO-32001 12.7.3.3, "Variable Text".- Parameters:
appearanceString
- aPdfString
that specifies the default appearance.- Returns:
- this
PdfFreeTextAnnotation
instance.
-
setDefaultAppearance
public PdfFreeTextAnnotation setDefaultAppearance(AnnotationDefaultAppearance da)
-
getCalloutLine
public PdfArray getCalloutLine()
-
setCalloutLine
public PdfFreeTextAnnotation setCalloutLine(float[] calloutLine)
-
setCalloutLine
public PdfFreeTextAnnotation setCalloutLine(PdfArray calloutLine)
-
getLineEndingStyle
public PdfName getLineEndingStyle()
-
setLineEndingStyle
public PdfFreeTextAnnotation setLineEndingStyle(PdfName lineEndingStyle)
-
getJustification
public int getJustification()
A code specifying the form of quadding (justification) that is used in displaying the annotation's text: 0 - Left-justified, 1 - Centered, 2 - Right-justified. Default value: 0 (left-justified).- Returns:
- a code specifying the form of quadding (justification), returns the default value if not explicitly specified.
-
setJustification
public PdfFreeTextAnnotation setJustification(int justification)
A code specifying the form of quadding (justification) that is used in displaying the annotation's text: 0 - Left-justified, 1 - Centered, 2 - Right-justified. Default value: 0 (left-justified).- Parameters:
justification
- a code specifying the form of quadding (justification).- Returns:
- this
PdfFreeTextAnnotation
instance.
-
getBorderStyle
public PdfDictionary getBorderStyle()
The dictionaries for some annotation types (such as free text and polygon annotations) can include the BS entry. That entry specifies a border style dictionary that has more settings than the array specified for the Border entry (seePdfAnnotation.getBorder()
). If an annotation dictionary includes the BS entry, then the Border entry is ignored. If annotation includes AP (seePdfAnnotation.getAppearanceDictionary()
) it takes precedence over the BS entry. For more info on BS entry see ISO-320001, Table 166.- Returns:
PdfDictionary
which is a border style dictionary or null if it is not specified.
-
setBorderStyle
public PdfFreeTextAnnotation setBorderStyle(PdfDictionary borderStyle)
Sets border style dictionary that has more settings than the array specified for the Border entry (PdfAnnotation.getBorder()
). See ISO-320001, Table 166 andgetBorderStyle()
for more info.- Parameters:
borderStyle
- a border style dictionary specifying the line width and dash pattern that shall be used in drawing the annotation’s border.- Returns:
- this
PdfFreeTextAnnotation
instance.
-
setBorderStyle
public PdfFreeTextAnnotation setBorderStyle(PdfName style)
Setter for the annotation's preset border style. Possible values arePdfAnnotation.STYLE_SOLID
- A solid rectangle surrounding the annotation.PdfAnnotation.STYLE_DASHED
- A dashed rectangle surrounding the annotation.PdfAnnotation.STYLE_BEVELED
- A simulated embossed rectangle that appears to be raised above the surface of the page.PdfAnnotation.STYLE_INSET
- A simulated engraved rectangle that appears to be recessed below the surface of the page.PdfAnnotation.STYLE_UNDERLINE
- A single line along the bottom of the annotation rectangle.
- Parameters:
style
- The new value for the annotation's border style.- Returns:
- this
PdfFreeTextAnnotation
instance. - See Also:
getBorderStyle()
-
setDashPattern
public PdfFreeTextAnnotation setDashPattern(PdfArray dashPattern)
Setter for the annotation's preset dashed border style. This property has affect only ifPdfAnnotation.STYLE_DASHED
style was used for the annotation border style (seesetBorderStyle(PdfName)
. See ISO-320001 8.4.3.6, "Line Dash Pattern" for the format in which dash pattern shall be specified.- Parameters:
dashPattern
- a dash array defining a pattern of dashes and gaps that shall be used in drawing a dashed border.- Returns:
- this
PdfFreeTextAnnotation
instance.
-
getRectangleDifferences
public PdfArray getRectangleDifferences()
A set of four numbers describing the numerical differences between two rectangles: the Rect entry of the annotation and the inner rectangle where the annotation's text should be displayed- Returns:
- null if not specified, otherwise a
PdfArray
with four numbers which correspond to the differences in default user space between the left, top, right, and bottom coordinates of Rect and those of the inner rectangle, respectively.
-
setRectangleDifferences
public PdfFreeTextAnnotation setRectangleDifferences(PdfArray rect)
A set of four numbers describing the numerical differences between two rectangles: the Rect entry of the annotation and the inner rectangle where the annotation's text should be displayed- Parameters:
rect
- aPdfArray
with four numbers which correspond to the differences in default user space between the left, top, right, and bottom coordinates of Rect and those of the inner rectangle, respectively. Each value shall be greater than or equal to 0. The sum of the top and bottom differences shall be less than the height of Rect, and the sum of the left and right differences shall be less than the width of Rect.- Returns:
- this
PdfFreeTextAnnotation
instance.
-
getBorderEffect
public PdfDictionary getBorderEffect()
A border effect dictionary that specifies an effect that shall be applied to the border of the annotations.- Returns:
- a
PdfDictionary
, which is a border effect dictionary (see ISO-320001, Table 167).
-
setBorderEffect
public PdfFreeTextAnnotation setBorderEffect(PdfDictionary borderEffect)
Sets a border effect dictionary that specifies an effect that shall be applied to the border of the annotations.- Parameters:
borderEffect
- aPdfDictionary
which contents shall be specified in accordance to ISO-320001, Table 167.- Returns:
- this
PdfFreeTextAnnotation
instance.
-
getRotation
public PdfNumber getRotation()
Gets the rotation angle in degrees.- Returns:
PdfNumber
representing the clockwise rotation in degrees.
-
setRotation
public PdfFreeTextAnnotation setRotation(int degAngle)
Sets the rotation angle in degrees.- Parameters:
degAngle
- an integer representing the clockwise rotation in degrees.- Returns:
- this
PdfFreeTextAnnotation
instance.
-
-