org.icepdf.core.pobjects.annotations
Class FreeTextAnnotation

java.lang.Object
  extended by org.icepdf.core.pobjects.Dictionary
      extended by org.icepdf.core.pobjects.annotations.Annotation
          extended by org.icepdf.core.pobjects.annotations.MarkupAnnotation
              extended by org.icepdf.core.pobjects.annotations.FreeTextAnnotation

public class FreeTextAnnotation
extends MarkupAnnotation

A free text annotation (PDF 1.3) displays text directly on the page. Unlike an ordinary text annotation (see 12.5.6.4, “Text Annotations�), a free text annotation has no open or closed state; instead of being displayed in a pop-up window, the text shall be always visible. Table 174 shows the annotation dictionary entries specific to this type of annotation. 12.7.3.3, “Variable Text� describes the process of using these entries to generate the appearance of the text in these annotations.

Since:
5.0

Field Summary
static Name BE_KEY
          (Optional; PDF 1.6) A border effect dictionary (see Table 167) used in conjunction with the border style dictionary specified by the BS entry.
static java.lang.String BODY_END
           
static java.lang.String BODY_START
           
static Name BS_KEY
          (Optional; PDF 1.6) A border style dictionary (see Table 166) specifying the line width and dash pattern that shall be used in drawing the annotation’s border.
static Name CL_KEY
          (Optional; meaningful only if IT is FreeTextCallout; PDF 1.6) An array of four or six numbers specifying a callout line attached to the free text annotation.
static Name DA_KEY
          (Required) The default appearance string that shall be used in formatting the text (see 12.7.3.3, “Variable Textâ€?).
protected  java.lang.String defaultAppearance
           
protected static java.awt.Color defaultFillColor
           
protected static java.awt.Color defaultFontColor
           
protected static int defaultFontSize
           
protected  java.lang.String defaultStylingString
           
protected  javax.swing.text.DefaultStyledDocument document
           
static Name DS_KEY
          (Optional; PDF 1.5) A default style string, as described in 12.7.3.4, “Rich Text Strings.â€?
static Name EMBEDDED_FONT_NAME
           
protected  FontFile fontFile
           
protected  boolean fontPropertyChanged
           
protected  boolean hideRenderedOutput
           
static Name LE_KEY
          (Optional; meaningful only if CL is present; PDF 1.6) A name specifying the line ending style that shall be used in drawing the callout line specified in CL.
static Name Q_KEY
          (Optional; PDF 1.4) A code specifying the form of quadding (justification) that shall be used in displaying the annotation’s text: 0 - Left-justified 1 - Centered 2 - Right-justified Default value: 0 (left-justified).
protected  int quadding
           
static int QUADDING_CENTER_JUSTIFIED
          Right-justified quadding
static int QUADDING_LEFT_JUSTIFIED
          Left-justified quadding
static int QUADDING_RIGHT_JUSTIFIED
          Center-justified quadding
static Name RD_KEY
          (Optional; PDF 1.6) A set of four numbers describing the numerical differences between two rectangles: the Rect entry of the annotation and a rectangle contained within that rectangle.
protected  java.lang.String richText
           
 
Fields inherited from class org.icepdf.core.pobjects.annotations.MarkupAnnotation
CA_KEY, CREATION_DATE_KEY, creationDate, EX_DATA_KEY, inReplyToAnnotation, intent, IRT_KEY, IT_KEY, opacity, POPUP_KEY, popupAnnotation, RC_KEY, replyToRelation, RT_KEY, SUBJ_KEY, subject, T_KEY, titleText
 
Fields inherited from class org.icepdf.core.pobjects.annotations.Annotation
ACTION_KEY, APPEARANCE_STATE_KEY, APPEARANCE_STREAM_DOWN_KEY, APPEARANCE_STREAM_KEY, APPEARANCE_STREAM_NORMAL_KEY, APPEARANCE_STREAM_ROLLOVER_KEY, bbox, BBOX_VALUE, border, BORDER_DASH, BORDER_HORIZONTAL_CORNER_RADIUS, BORDER_KEY, BORDER_STYLE_KEY, BORDER_VERTICAL_CORNER_RADIUS, BORDER_WIDTH, borderStyle, canDrawBorder, color, COLOR_KEY, compressAppearanceStream, content, CONTENTS_KEY, FLAG_HIDDEN, FLAG_INVISIBLE, FLAG_KEY, FLAG_LOCKED, FLAG_LOCKED_CONTENTS, FLAG_NO_ROTATE, FLAG_NO_VIEW, FLAG_NO_ZOOM, FLAG_PRINT, FLAG_READ_ONLY, FLAG_TOGGLE_NO_VIEW, hasBlendingMode, INVISIBLE_RECTANGLE, M_KEY, matrix, modifiedDate, NM_KEY, PARENT_KEY, PARENT_PAGE_KEY, RECTANGLE_KEY, RESOURCES_VALUE, securityManager, shapes, subtype, SUBTYPE_CIRCLE, SUBTYPE_FREE_TEXT, SUBTYPE_HIGHLIGHT, SUBTYPE_INK, SUBTYPE_LINE, SUBTYPE_LINK, SUBTYPE_POLYGON, SUBTYPE_POLYLINE, SUBTYPE_POPUP, SUBTYPE_SQUARE, SUBTYPE_TEXT, SUBTYPE_WIDGET, TYPE, TYPE_VALUE, userSpaceRectangle, VISIBLE_RECTANGLE
 
Fields inherited from class org.icepdf.core.pobjects.Dictionary
entries, FORM_TYPE_KEY, inited, isDeleted, isNew, LENGTH_KEY, library, SUBTYPE_KEY, TYPE_KEY
 
Constructor Summary
FreeTextAnnotation(Library l, java.util.HashMap h)
           
 
Method Summary
 void clearShapes()
           
 java.lang.String getDefaultAppearance()
           
 java.lang.String getDefaultStylingString()
           
 java.awt.Color getFillColor()
           
 java.awt.Color getFontColor()
           
 java.lang.String getFontName()
           
 int getFontSize()
           
 int getFontStyle()
           
static FreeTextAnnotation getInstance(Library library, java.awt.Rectangle rect)
          Gets an instance of a FreeTextAnnotation that has valid Object Reference.
 int getQuadding()
           
 java.lang.String getRichText()
           
 void init()
          Initiate the Dictionary.
 boolean isFillType()
           
 boolean isFontPropertyChanged()
           
 boolean isHideRenderedOutput()
           
 boolean isStrokeType()
           
 void render(java.awt.Graphics2D origG, int renderHintType, float totalRotation, float userZoom, boolean tabSelected)
           
 void resetAppearanceStream(double dx, double dy, java.awt.geom.AffineTransform pageTransform)
           
 void setDefaultAppearance(java.lang.String defaultAppearance)
           
 void setDocument(javax.swing.text.DefaultStyledDocument document)
           
 void setFillColor(java.awt.Color fillColor)
           
 void setFillType(boolean fillType)
           
 void setFontColor(java.awt.Color fontColor)
           
 void setFontName(java.lang.String fontName)
           
 void setFontSize(int fontSize)
           
 void setFontStyle(int fontStyle)
           
 void setHideRenderedOutput(boolean hideRenderedOutput)
           
 void setQuadding(int quadding)
           
 void setRichText(java.lang.String richText)
           
 void setStrokeType(boolean strokeType)
           
 
Methods inherited from class org.icepdf.core.pobjects.annotations.MarkupAnnotation
getCreationDate, getInReplyToAnnotation, getIntent, getOpacity, getPopupAnnotation, getReplyToRelation, getSubject, getTitleText, setCreationDate, setInReplyToAnnotation, setPopupAnnotation, setSubject, setTitleText, toString
 
Methods inherited from class org.icepdf.core.pobjects.annotations.Annotation
addAction, allowAlterProperties, allowPrintNormalMode, allowScreenDownMode, allowScreenNormalMode, allowScreenOrPrintRenderingOrInteraction, allowScreenRolloverMode, buildAnnotation, deleteAction, deriveDrawingRectangle, getAction, getAppearanceStream, getBbox, getBorder, getBorderStyle, getBorderStyleStroke, getBorderType, getColor, getContents, getFlagHidden, getFlagInvisible, getFlagLocked, getFlagLockedContents, getFlagNoRotate, getFlagNoView, getFlagNoZoom, getFlagPrint, getFlagReadOnly, getFlagToggleNoView, getLineStyle, getLineThickness, getPage, getParentAnnotation, getShapes, getSubType, getUserSpaceRectangle, hasAppearanceStream, isBorder, isSupportedAnnotationType, renderAppearanceStream, renderBorder, renderBorderTabSelected, resetAppearanceStream, setBBox, setBorderStyle, setColor, setCompressAppearanceStream, setContents, setFlag, setModifiedDate, setSubtype, setUserSpaceRectangle, syncBBoxToUserSpaceRectangle, updateAction
 
Methods inherited from class org.icepdf.core.pobjects.Dictionary
getEntries, getFloat, getInt, getLibrary, getNumber, getObject, getPObjectReference, isDeleted, isNew, setDeleted, setNew, setPObjectReference
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DA_KEY

public static final Name DA_KEY
(Required) The default appearance string that shall be used in formatting the text (see 12.7.3.3, “Variable Text�).

The annotation dictionary’s AP entry, if present, shall take precedence over the DA entry; see Table 168 and 12.5.5, “Appearance Streams.�


Q_KEY

public static final Name Q_KEY
(Optional; PDF 1.4) A code specifying the form of quadding (justification) that shall be used in displaying the annotation’s text: 0 - Left-justified 1 - Centered 2 - Right-justified Default value: 0 (left-justified).


DS_KEY

public static final Name DS_KEY
(Optional; PDF 1.5) A default style string, as described in 12.7.3.4, “Rich Text Strings.�


CL_KEY

public static final Name CL_KEY
(Optional; meaningful only if IT is FreeTextCallout; PDF 1.6) An array of four or six numbers specifying a callout line attached to the free text annotation. Six numbers [ x1 y1 x2 y2 x3 y3 ] represent the starting, knee point, and ending coordinates of the line in default user space, as shown in Figure 8.4. Four numbers [ x1 y1 x2 y2 ] represent the starting and ending coordinates of the line.


BE_KEY

public static final Name BE_KEY
(Optional; PDF 1.6) A border effect dictionary (see Table 167) used in conjunction with the border style dictionary specified by the BS entry.


RD_KEY

public static final Name RD_KEY
(Optional; PDF 1.6) A set of four numbers describing the numerical differences between two rectangles: the Rect entry of the annotation and a rectangle contained within that rectangle. The inner rectangle is where the annotation’s text should be displayed. Any border styles and/or border effects specified by BS and BE entries, respectively, shall be applied to the border of the inner rectangle.

The four numbers 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.


BS_KEY

public static final Name BS_KEY
(Optional; PDF 1.6) A border style dictionary (see Table 166) specifying the line width and dash pattern that shall be used in drawing the annotation’s border.

The annotation dictionary’s AP entry, if present, takes precedence over the BS entry; see Table 164 and 12.5.5, “Appearance Streams�.


LE_KEY

public static final Name LE_KEY
(Optional; meaningful only if CL is present; PDF 1.6) A name specifying the line ending style that shall be used in drawing the callout line specified in CL. The name shall specify the line ending style for the endpoint defined by the pairs of coordinates (x1, y1). Table 176 shows the possible line ending styles.

Default value: None.


QUADDING_LEFT_JUSTIFIED

public static final int QUADDING_LEFT_JUSTIFIED
Left-justified quadding

See Also:
Constant Field Values

QUADDING_CENTER_JUSTIFIED

public static final int QUADDING_CENTER_JUSTIFIED
Right-justified quadding

See Also:
Constant Field Values

QUADDING_RIGHT_JUSTIFIED

public static final int QUADDING_RIGHT_JUSTIFIED
Center-justified quadding

See Also:
Constant Field Values

EMBEDDED_FONT_NAME

public static final Name EMBEDDED_FONT_NAME

defaultFontColor

protected static java.awt.Color defaultFontColor

defaultFillColor

protected static java.awt.Color defaultFillColor

defaultFontSize

protected static int defaultFontSize

defaultAppearance

protected java.lang.String defaultAppearance

quadding

protected int quadding

defaultStylingString

protected java.lang.String defaultStylingString

hideRenderedOutput

protected boolean hideRenderedOutput

richText

protected java.lang.String richText

document

protected javax.swing.text.DefaultStyledDocument document

fontFile

protected FontFile fontFile

fontPropertyChanged

protected boolean fontPropertyChanged

BODY_START

public static final java.lang.String BODY_START
See Also:
Constant Field Values

BODY_END

public static final java.lang.String BODY_END
See Also:
Constant Field Values
Constructor Detail

FreeTextAnnotation

public FreeTextAnnotation(Library l,
                          java.util.HashMap h)
Method Detail

init

public void init()
Description copied from class: Dictionary
Initiate the Dictionary. Retrieve any needed attributes.

Overrides:
init in class MarkupAnnotation

getInstance

public static FreeTextAnnotation getInstance(Library library,
                                             java.awt.Rectangle rect)
Gets an instance of a FreeTextAnnotation that has valid Object Reference.

Parameters:
library - document library
rect - bounding rectangle in user space
Returns:
new FreeTextAnnotation Instance.

render

public void render(java.awt.Graphics2D origG,
                   int renderHintType,
                   float totalRotation,
                   float userZoom,
                   boolean tabSelected)
Overrides:
render in class Annotation

resetAppearanceStream

public void resetAppearanceStream(double dx,
                                  double dy,
                                  java.awt.geom.AffineTransform pageTransform)
Specified by:
resetAppearanceStream in class Annotation

getDefaultStylingString

public java.lang.String getDefaultStylingString()

clearShapes

public void clearShapes()

setDocument

public void setDocument(javax.swing.text.DefaultStyledDocument document)

isHideRenderedOutput

public boolean isHideRenderedOutput()

setHideRenderedOutput

public void setHideRenderedOutput(boolean hideRenderedOutput)

getDefaultAppearance

public java.lang.String getDefaultAppearance()

setDefaultAppearance

public void setDefaultAppearance(java.lang.String defaultAppearance)

getQuadding

public int getQuadding()

setQuadding

public void setQuadding(int quadding)

getRichText

public java.lang.String getRichText()
Overrides:
getRichText in class MarkupAnnotation

setRichText

public void setRichText(java.lang.String richText)
Overrides:
setRichText in class MarkupAnnotation

getFontColor

public java.awt.Color getFontColor()

setFontColor

public void setFontColor(java.awt.Color fontColor)

getFillColor

public java.awt.Color getFillColor()

setFillColor

public void setFillColor(java.awt.Color fillColor)

getFontName

public java.lang.String getFontName()

setFontName

public void setFontName(java.lang.String fontName)

getFontStyle

public int getFontStyle()

setFontStyle

public void setFontStyle(int fontStyle)

getFontSize

public int getFontSize()

setFontSize

public void setFontSize(int fontSize)

isFillType

public boolean isFillType()

isFontPropertyChanged

public boolean isFontPropertyChanged()

setFillType

public void setFillType(boolean fillType)

isStrokeType

public boolean isStrokeType()

setStrokeType

public void setStrokeType(boolean strokeType)