Class PDAnnotationText
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation
-
- org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationMarkup
-
- org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationText
-
- All Implemented Interfaces:
COSObjectable
public class PDAnnotationText extends PDAnnotationMarkup
This is the class that represents a text annotation.
-
-
Field Summary
Fields Modifier and Type Field Description private PDAppearanceHandler
customAppearanceHandler
static java.lang.String
NAME_CHECK
Constant for the name of a check annotation.static java.lang.String
NAME_CIRCLE
Constant for the name of a circle annotation.static java.lang.String
NAME_COMMENT
Constant for the name of a text annotation.static java.lang.String
NAME_CROSS
Constant for the name of a cross annotation.static java.lang.String
NAME_CROSS_HAIRS
Constant for the name of a crosshairs annotation.static java.lang.String
NAME_HELP
Constant for the name of a text annotation.static java.lang.String
NAME_INSERT
Constant for the name of a text annotation.static java.lang.String
NAME_KEY
Constant for the name of a text annotation.static java.lang.String
NAME_NEW_PARAGRAPH
Constant for the name of a text annotation.static java.lang.String
NAME_NOTE
Constant for the name of a text annotation.static java.lang.String
NAME_PARAGRAPH
Constant for the name of a text annotation.static java.lang.String
NAME_RIGHT_ARROW
Constant for the name of a right arrow annotation.static java.lang.String
NAME_RIGHT_POINTER
Constant for the name of a right pointer annotation.static java.lang.String
NAME_STAR
Constant for the name of a star annotation.static java.lang.String
NAME_UP_ARROW
Constant for the name of a crosshairs annotation.static java.lang.String
NAME_UP_LEFT_ARROW
Constant for the name of a crosshairs annotation.static java.lang.String
SUB_TYPE
The type of annotation.-
Fields inherited from class org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationMarkup
IT_FREE_TEXT, IT_FREE_TEXT_CALLOUT, IT_FREE_TEXT_TYPE_WRITER, RT_GROUP, RT_REPLY, SUB_TYPE_CARET, SUB_TYPE_FREETEXT, SUB_TYPE_INK, SUB_TYPE_POLYGON, SUB_TYPE_POLYLINE, SUB_TYPE_SOUND
-
-
Constructor Summary
Constructors Constructor Description PDAnnotationText()
Constructor.PDAnnotationText(COSDictionary field)
Creates a Text annotation from a COSDictionary, expected to be a correct object definition.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
constructAppearances()
Create the appearance entry for this annotation.void
constructAppearances(PDDocument document)
Create the appearance entry for this annotation.java.lang.String
getName()
This will retrieve the name (and hence appearance, AP taking precedence) For this annotation.boolean
getOpen()
This will retrieve the initial state of the annotation, open Or closed (default closed).java.lang.String
getState()
This will retrieve the annotation state.java.lang.String
getStateModel()
This will retrieve the annotation state model.void
setCustomAppearanceHandler(PDAppearanceHandler appearanceHandler)
Set a custom appearance handler for generating the annotations appearance streams.void
setName(java.lang.String name)
This will set the name (and hence appearance, AP taking precedence) For this annotation.void
setOpen(boolean open)
This will set initial state of the annotation, open or closed.void
setState(java.lang.String state)
This will set the annotation state.void
setStateModel(java.lang.String stateModel)
This will set the annotation state model.-
Methods inherited from class org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationMarkup
getBorderEffect, getBorderStyle, getCallout, getConstantOpacity, getCreationDate, getDefaultAppearance, getDefaultStyleString, getEndPointEndingStyle, getExternalData, getInkList, getInReplyTo, getIntent, getInteriorColor, getLineEndingStyle, getPath, getPopup, getQ, getRectDifference, getRectDifferences, getReplyType, getRichContents, getStartPointEndingStyle, getSubject, getTitlePopup, getVertices, setBorderEffect, setBorderStyle, setCallout, setConstantOpacity, setCreationDate, setDefaultAppearance, setDefaultStyleString, setEndPointEndingStyle, setExternalData, setInkList, setInReplyTo, setIntent, setInteriorColor, setLineEndingStyle, setPopup, setQ, setRectDifference, setRectDifferences, setRectDifferences, setReplyType, setRichContents, setStartPointEndingStyle, setSubject, setTitlePopup, setVertices
-
Methods inherited from class org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation
createAnnotation, equals, getAnnotationFlags, getAnnotationName, getAppearance, getAppearanceState, getBorder, getColor, getColor, getContents, getCOSObject, getModifiedDate, getNormalAppearanceStream, getOptionalContent, getPage, getRectangle, getStructParent, getSubtype, hashCode, isHidden, isInvisible, isLocked, isLockedContents, isNoRotate, isNoView, isNoZoom, isPrinted, isReadOnly, isToggleNoView, setAnnotationFlags, setAnnotationName, setAppearance, setAppearanceState, setBorder, setColor, setContents, setHidden, setInvisible, setLocked, setLockedContents, setModifiedDate, setModifiedDate, setNoRotate, setNoView, setNoZoom, setOptionalContent, setPage, setPrinted, setReadOnly, setRectangle, setStructParent, setToggleNoView
-
-
-
-
Field Detail
-
customAppearanceHandler
private PDAppearanceHandler customAppearanceHandler
-
NAME_COMMENT
public static final java.lang.String NAME_COMMENT
Constant for the name of a text annotation.- See Also:
- Constant Field Values
-
NAME_KEY
public static final java.lang.String NAME_KEY
Constant for the name of a text annotation.- See Also:
- Constant Field Values
-
NAME_NOTE
public static final java.lang.String NAME_NOTE
Constant for the name of a text annotation.- See Also:
- Constant Field Values
-
NAME_HELP
public static final java.lang.String NAME_HELP
Constant for the name of a text annotation.- See Also:
- Constant Field Values
-
NAME_NEW_PARAGRAPH
public static final java.lang.String NAME_NEW_PARAGRAPH
Constant for the name of a text annotation.- See Also:
- Constant Field Values
-
NAME_PARAGRAPH
public static final java.lang.String NAME_PARAGRAPH
Constant for the name of a text annotation.- See Also:
- Constant Field Values
-
NAME_INSERT
public static final java.lang.String NAME_INSERT
Constant for the name of a text annotation.- See Also:
- Constant Field Values
-
NAME_CIRCLE
public static final java.lang.String NAME_CIRCLE
Constant for the name of a circle annotation.- See Also:
- Constant Field Values
-
NAME_CROSS
public static final java.lang.String NAME_CROSS
Constant for the name of a cross annotation.- See Also:
- Constant Field Values
-
NAME_STAR
public static final java.lang.String NAME_STAR
Constant for the name of a star annotation.- See Also:
- Constant Field Values
-
NAME_CHECK
public static final java.lang.String NAME_CHECK
Constant for the name of a check annotation.- See Also:
- Constant Field Values
-
NAME_RIGHT_ARROW
public static final java.lang.String NAME_RIGHT_ARROW
Constant for the name of a right arrow annotation.- See Also:
- Constant Field Values
-
NAME_RIGHT_POINTER
public static final java.lang.String NAME_RIGHT_POINTER
Constant for the name of a right pointer annotation.- See Also:
- Constant Field Values
-
NAME_UP_ARROW
public static final java.lang.String NAME_UP_ARROW
Constant for the name of a crosshairs annotation.- See Also:
- Constant Field Values
-
NAME_UP_LEFT_ARROW
public static final java.lang.String NAME_UP_LEFT_ARROW
Constant for the name of a crosshairs annotation.- See Also:
- Constant Field Values
-
NAME_CROSS_HAIRS
public static final java.lang.String NAME_CROSS_HAIRS
Constant for the name of a crosshairs annotation.- See Also:
- Constant Field Values
-
SUB_TYPE
public static final java.lang.String SUB_TYPE
The type of annotation.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PDAnnotationText
public PDAnnotationText()
Constructor.
-
PDAnnotationText
public PDAnnotationText(COSDictionary field)
Creates a Text annotation from a COSDictionary, expected to be a correct object definition.- Parameters:
field
- the PDF object to represent as a field.
-
-
Method Detail
-
setOpen
public void setOpen(boolean open)
This will set initial state of the annotation, open or closed.- Parameters:
open
- Boolean value, true = open false = closed
-
getOpen
public boolean getOpen()
This will retrieve the initial state of the annotation, open Or closed (default closed).- Returns:
- The initial state, true = open false = closed
-
setName
public void setName(java.lang.String name)
This will set the name (and hence appearance, AP taking precedence) For this annotation. See the NAME_XXX constants for valid values.- Parameters:
name
- The name of the annotation
-
getName
public java.lang.String getName()
This will retrieve the name (and hence appearance, AP taking precedence) For this annotation. The default is NOTE.- Returns:
- The name of this annotation, see the NAME_XXX constants.
-
getState
public java.lang.String getState()
This will retrieve the annotation state.- Returns:
- the annotation state
-
setState
public void setState(java.lang.String state)
This will set the annotation state.- Parameters:
state
- the annotation state
-
getStateModel
public java.lang.String getStateModel()
This will retrieve the annotation state model.- Returns:
- the annotation state model
-
setStateModel
public void setStateModel(java.lang.String stateModel)
This will set the annotation state model. Allowed values are "Marked" and "Review"- Parameters:
stateModel
- the annotation state model
-
setCustomAppearanceHandler
public void setCustomAppearanceHandler(PDAppearanceHandler appearanceHandler)
Set a custom appearance handler for generating the annotations appearance streams.- Overrides:
setCustomAppearanceHandler
in classPDAnnotationMarkup
- Parameters:
appearanceHandler
-
-
constructAppearances
public void constructAppearances()
Description copied from class:PDAnnotation
Create the appearance entry for this annotation. Not having it may prevent display in some viewers. This method is for overriding in subclasses, the default implementation does nothing.- Overrides:
constructAppearances
in classPDAnnotationMarkup
-
constructAppearances
public void constructAppearances(PDDocument document)
Description copied from class:PDAnnotation
Create the appearance entry for this annotation. Not having it may prevent display in some viewers. This method is for overriding in subclasses, the default implementation does nothing.- Overrides:
constructAppearances
in classPDAnnotationMarkup
-
-