Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel.interactive.annotation

public Class PDAnnotationText

extends PDAnnotationMarkup
Class Inheritance
Imports
org.apache.pdfbox.cos.COSDictionary, .COSName, org.apache.pdfbox.pdmodel.PDDocument, org.apache.pdfbox.pdmodel.interactive.annotation.handlers.PDAppearanceHandler, .PDTextAppearanceHandler

This is the class that represents a text annotation.
Author
Paul King

Field Summary

Modifier and TypeField and Description
private PDAppearanceHandler
public static final String
NAME_CHECK

Constant for the name of a check annotation.

public static final String
NAME_CIRCLE

Constant for the name of a circle annotation.

public static final String
NAME_COMMENT

Constant for the name of a text annotation.

public static final String
NAME_CROSS

Constant for the name of a cross annotation.

public static final String
NAME_CROSS_HAIRS

Constant for the name of a crosshairs annotation.

public static final String
NAME_HELP

Constant for the name of a text annotation.

public static final String
NAME_INSERT

Constant for the name of a text annotation.

public static final String
NAME_KEY

Constant for the name of a text annotation.

public static final String
NAME_NEW_PARAGRAPH

Constant for the name of a text annotation.

public static final String
NAME_NOTE

Constant for the name of a text annotation.

public static final String
NAME_PARAGRAPH

Constant for the name of a text annotation.

public static final String
NAME_RIGHT_ARROW

Constant for the name of a right arrow annotation.

public static final String
NAME_RIGHT_POINTER

Constant for the name of a right pointer annotation.

public static final String
NAME_STAR

Constant for the name of a star annotation.

public static final String
NAME_UP_ARROW

Constant for the name of a crosshairs annotation.

public static final String
NAME_UP_LEFT_ARROW

Constant for the name of a crosshairs annotation.

public static final String
SUB_TYPE

The type of annotation.

Inherited from org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationMarkup:
RT_GROUPRT_REPLY

Constructor Summary

AccessConstructor and Description
public
PDAnnotationText()

Constructor.

public
PDAnnotationText(COSDictionary
the PDF object to represent as a field.
field
)

Creates a Text annotation from a COSDictionary, expected to be a correct object definition.

Method Summary

Modifier and TypeMethod and Description
public void
public void
constructAppearances(PDDocument
the related document
document
)

Overrides org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation.constructAppearances.

Create the appearance entry for this annotation.

public String

Returns:

The name of this annotation, see the NAME_XXX constants.
getName
()

This will retrieve the name (and hence appearance, AP taking precedence) For this annotation.

public boolean

Returns:

The initial state, true = open false = closed
getOpen
()

This will retrieve the initial state of the annotation, open Or closed (default closed).

public String

Returns:

the annotation state
getState
()

This will retrieve the annotation state.

public String

Returns:

the annotation state model
getStateModel
()

This will retrieve the annotation state model.

public void
setCustomAppearanceHandler(PDAppearanceHandler
custom appearance handler
appearanceHandler
)

Set a custom appearance handler for generating the annotations appearance streams.

public void
setName(String
The name of the annotation
name
)

This will set the name (and hence appearance, AP taking precedence) For this annotation.

public void
setOpen(boolean
Boolean value, true = open false = closed
open
)

This will set initial state of the annotation, open or closed.

public void
setState(String
the annotation state
state
)

This will set the annotation state.

public void
setStateModel(String
the annotation state model
stateModel
)

This will set the annotation state model.

Inherited from org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationMarkup:
getBorderStylegetConstantOpacitygetCreationDategetExternalDatagetInReplyTogetIntentgetPopupgetReplyTypegetRichContentsgetSubjectgetTitlePopupsetBorderStylesetConstantOpacitysetCreationDatesetExternalDatasetInReplyTosetIntentsetPopupsetReplyTypesetRichContentssetSubjectsetTitlePopup

Field Detail

customAppearanceHandlerback to summary
private PDAppearanceHandler customAppearanceHandler
NAME_CHECKback to summary
public static final String NAME_CHECK

Constant for the name of a check annotation.

NAME_CIRCLEback to summary
public static final String NAME_CIRCLE

Constant for the name of a circle annotation.

NAME_COMMENTback to summary
public static final String NAME_COMMENT

Constant for the name of a text annotation.

NAME_CROSSback to summary
public static final String NAME_CROSS

Constant for the name of a cross annotation.

NAME_CROSS_HAIRSback to summary
public static final String NAME_CROSS_HAIRS

Constant for the name of a crosshairs annotation.

NAME_HELPback to summary
public static final String NAME_HELP

Constant for the name of a text annotation.

NAME_INSERTback to summary
public static final String NAME_INSERT

Constant for the name of a text annotation.

NAME_KEYback to summary
public static final String NAME_KEY

Constant for the name of a text annotation.

NAME_NEW_PARAGRAPHback to summary
public static final String NAME_NEW_PARAGRAPH

Constant for the name of a text annotation.

NAME_NOTEback to summary
public static final String NAME_NOTE

Constant for the name of a text annotation.

NAME_PARAGRAPHback to summary
public static final String NAME_PARAGRAPH

Constant for the name of a text annotation.

NAME_RIGHT_ARROWback to summary
public static final String NAME_RIGHT_ARROW

Constant for the name of a right arrow annotation.

NAME_RIGHT_POINTERback to summary
public static final String NAME_RIGHT_POINTER

Constant for the name of a right pointer annotation.

NAME_STARback to summary
public static final String NAME_STAR

Constant for the name of a star annotation.

NAME_UP_ARROWback to summary
public static final String NAME_UP_ARROW

Constant for the name of a crosshairs annotation.

NAME_UP_LEFT_ARROWback to summary
public static final String NAME_UP_LEFT_ARROW

Constant for the name of a crosshairs annotation.

SUB_TYPEback to summary
public static final String SUB_TYPE

The type of annotation.

Constructor Detail

PDAnnotationTextback to summary
public PDAnnotationText()

Constructor.

PDAnnotationTextback to summary
public PDAnnotationText(COSDictionary field)

Creates a Text annotation from a COSDictionary, expected to be a correct object definition.

Parameters
field:COSDictionary

the PDF object to represent as a field.

Method Detail

constructAppearancesback to summary
public void constructAppearances()

Overrides org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation.constructAppearances.

Doc from org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation.constructAppearances.

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.

Annotations
@Override
constructAppearancesback to summary
public void constructAppearances(PDDocument document)

Overrides org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation.constructAppearances.

Doc from org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation.constructAppearances.

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.

Parameters
document:PDDocument

the related document

Annotations
@Override
getNameback to summary
public String getName()

This will retrieve the name (and hence appearance, AP taking precedence) For this annotation. The default is NOTE.

Returns:String

The name of this annotation, see the NAME_XXX constants.

getOpenback to summary
public boolean getOpen()

This will retrieve the initial state of the annotation, open Or closed (default closed).

Returns:boolean

The initial state, true = open false = closed

getStateback to summary
public String getState()

This will retrieve the annotation state.

Returns:String

the annotation state

getStateModelback to summary
public String getStateModel()

This will retrieve the annotation state model.

Returns:String

the annotation state model

setCustomAppearanceHandlerback to summary
public void setCustomAppearanceHandler(PDAppearanceHandler appearanceHandler)

Set a custom appearance handler for generating the annotations appearance streams.

Parameters
appearanceHandler:PDAppearanceHandler

custom appearance handler

setNameback to summary
public void setName(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:String

The name of the annotation

setOpenback to summary
public void setOpen(boolean open)

This will set initial state of the annotation, open or closed.

Parameters
open:boolean

Boolean value, true = open false = closed

setStateback to summary
public void setState(String state)

This will set the annotation state.

Parameters
state:String

the annotation state

setStateModelback to summary
public void setStateModel(String stateModel)

This will set the annotation state model. Allowed values are "Marked" and "Review"

Parameters
stateModel:String

the annotation state model