Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel.fdf

public abstract Class FDFAnnotation

extends Object
implements COSObjectable
Class Inheritance
All Implemented Interfaces
org.apache.pdfbox.pdmodel.common.COSObjectable
Known Direct Subclasses
org.apache.pdfbox.pdmodel.fdf.FDFAnnotationCaret, org.apache.pdfbox.pdmodel.fdf.FDFAnnotationCircle, org.apache.pdfbox.pdmodel.fdf.FDFAnnotationFileAttachment, org.apache.pdfbox.pdmodel.fdf.FDFAnnotationFreeText, org.apache.pdfbox.pdmodel.fdf.FDFAnnotationInk, org.apache.pdfbox.pdmodel.fdf.FDFAnnotationLine, org.apache.pdfbox.pdmodel.fdf.FDFAnnotationLink, org.apache.pdfbox.pdmodel.fdf.FDFAnnotationPolygon, org.apache.pdfbox.pdmodel.fdf.FDFAnnotationPolyline, org.apache.pdfbox.pdmodel.fdf.FDFAnnotationSound, org.apache.pdfbox.pdmodel.fdf.FDFAnnotationSquare, org.apache.pdfbox.pdmodel.fdf.FDFAnnotationStamp, org.apache.pdfbox.pdmodel.fdf.FDFAnnotationText, org.apache.pdfbox.pdmodel.fdf.FDFAnnotationTextMarkup
Imports
java.awt.Color, java.io.IOException, java.util.Calendar, javax.xml.xpath.XPath, .XPathConstants, .XPathExpressionException, .XPathFactory, org.apache.commons.logging.Log, .LogFactory, org.apache.pdfbox.cos.COSArray, .COSBase, .COSDictionary, .COSName, .COSNumber, .COSStream, .COSString, org.apache.pdfbox.pdmodel.common.COSObjectable, .PDRectangle, org.apache.pdfbox.pdmodel.interactive.annotation.PDBorderEffectDictionary, .PDBorderStyleDictionary, org.apache.pdfbox.util.DateConverter, org.w3c.dom.CDATASection, .Element, .NamedNodeMap, .Node, .NodeList, .Text

This represents an FDF annotation that is part of the FDF document.
Authors
Ben Litchfield, Johanneke Lamberink

Field Summary

Modifier and TypeField and Description
protected final COSDictionary
annot

Annotation dictionary.

private static final int
FLAG_HIDDEN

An annotation flag.

private static final int
FLAG_INVISIBLE

An annotation flag.

private static final int
FLAG_LOCKED

An annotation flag.

private static final int
FLAG_LOCKED_CONTENTS

An annotation flag.

private static final int
FLAG_NO_ROTATE

An annotation flag.

private static final int
FLAG_NO_VIEW

An annotation flag.

private static final int
FLAG_NO_ZOOM

An annotation flag.

private static final int
FLAG_PRINTED

An annotation flag.

private static final int
FLAG_READ_ONLY

An annotation flag.

private static final int
FLAG_TOGGLE_NO_VIEW

An annotation flag.

private static final Log

Constructor Summary

AccessConstructor and Description
public
FDFAnnotation()

Default constructor.

public
FDFAnnotation(COSDictionary
The FDF annotation.
a
)

Constructor.

public
FDFAnnotation(Element
An XFDF element.
element
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public static FDFAnnotation

Returns:

A newly created FDFAnnotation
create
(COSDictionary
The FDF dictionary.
fdfDic
)

Create the correct FDFAnnotation.

public PDBorderEffectDictionary

Returns:

the border effect dictionary.
getBorderEffect
()

This will retrieve the border style dictionary, describing the effect applied to the border described by the BS entry.

public PDBorderStyleDictionary

Returns:

the border style dictionary.
getBorderStyle
()

This will retrieve the border style dictionary, specifying the width and dash pattern used in drawing the annotation.

public Color

Returns:

The annotation color, or null if there is none.
getColor
()

Get the annotation color.

public String

Returns:

The text, or a description, of the annotation.
getContents
()

Get the text, or a description, of the annotation.

public COSDictionary

Returns:

The cos object that matches this Java object.
getCOSObject
()

Implements org.apache.pdfbox.pdmodel.common.COSObjectable.getCOSObject.

Convert this standard java object to a COS object.

public Calendar

Returns:

The date of the creation of the annotation date
getCreationDate
()

The annotation create date.

public String

Returns:

The date as a string.
getDate
()

Modification date.

public String

Returns:

The intent of the annotation.
getIntent
()

Get the intent of the annotation.

public String

Returns:

The unique name of the annotation.
getName
()

Get the annotation name.

public float

Returns:

The opacity of the annotation.
getOpacity
()

Get the opacity value.

public Integer

Returns:

The page number.
getPage
()

This will get the page number or null if it does not exist.

public PDRectangle

Returns:

The annotation rectangle.
getRectangle
()

The rectangle associated with this annotation.

public String

Returns:

the rich text stream.
getRichContents
()

This will retrieve the rich text stream which is displayed in the popup window.

protected final String

Returns:

the text stream
getStringOrStream
(COSBase
the potential text or text stream
base
)

Get a text or text stream.

public String

Returns:

The subject of the annotation.
getSubject
()

Get the description of the annotation.

public String

Returns:

The title of the annotation.
getTitle
()

Get the annotation title.

public boolean

Returns:

The hidden flag.
isHidden
()

Get the hidden flag.

public boolean

Returns:

The invisible flag.
isInvisible
()

Get the invisible flag.

public boolean

Returns:

The locked flag.
isLocked
()

Get the locked flag.

public boolean

Returns:

The LockedContents flag.
isLockedContents
()

Get the LockedContents flag.

public boolean

Returns:

The noRotate flag.
isNoRotate
()

Get the noRotate flag.

public boolean

Returns:

The noView flag.
isNoView
()

Get the noView flag.

public boolean

Returns:

The noZoom flag.
isNoZoom
()

Get the noZoom flag.

public boolean

Returns:

The printed flag.
isPrinted
()

Get the printed flag.

public boolean

Returns:

The readOnly flag.
isReadOnly
()

Get the readOnly flag.

public boolean

Returns:

The toggleNoView flag.
isToggleNoView
()

Get the toggleNoView flag.

private String
richContentsToString(Node node, boolean root)

public final void
setBorderEffect(PDBorderEffectDictionary
the border effect dictionary to set.
be
)

This will set the border effect dictionary, describing the effect applied to the border described by the BS entry.

public final void
setBorderStyle(PDBorderStyleDictionary
the border style dictionary to set.
bs
)

This will set the border style dictionary, specifying the width and dash pattern used in drawing the annotation.

public final void
setColor(Color
The annotation color.
c
)

Set the annotation color.

public final void
setContents(String
The annotation contents, or a description.
contents
)

Set the contents, or a description, for an annotation.

public final void
setCreationDate(Calendar
The date the annotation was created.
date
)

Set the creation date.

public final void
setDate(String
The date to store in the FDF annotation.
date
)

The annotation modification date.

public final void
setHidden(boolean
The new hidden flag.
hidden
)

Set the hidden flag.

public final void
setIntent(String
The annotation's intent.
intent
)

The intent of the annotation.

public final void
setInvisible(boolean
The new invisible flag.
invisible
)

Set the invisible flag.

public final void
setLocked(boolean
The new locked flag.
locked
)

Set the locked flag.

public void
setLockedContents(boolean
The new LockedContents flag.
lockedContents
)

Set the LockedContents flag.

public final void
setName(String
The unique annotation name.
name
)

Set a unique name for an annotation.

public final void
setNoRotate(boolean
The new noRotate flag.
noRotate
)

Set the noRotate flag.

public final void
setNoView(boolean
The new noView flag.
noView
)

Set the noView flag.

public final void
setNoZoom(boolean
The new noZoom flag.
noZoom
)

Set the noZoom flag.

public final void
setOpacity(float
The new opacity value.
opacity
)

Set the annotation opacity.

public final void
setPage(int
The page number.
page
)

This will set the page.

public final void
setPrinted(boolean
The new printed flag.
printed
)

Set the printed flag.

public final void
setReadOnly(boolean
The new readOnly flag.
readOnly
)

Set the readOnly flag.

public final void
setRectangle(PDRectangle
The annotation rectangle.
rectangle
)

Set the rectangle associated with this annotation.

public final void
setRichContents(String
the rich text stream.
rc
)

This will set the rich text stream which is displayed in the popup window.

public final void
setSubject(String
The annotation subject.
subject
)

A short description of the annotation.

public final void
setTitle(String
The annotation title.
title
)

Set a unique title for an annotation.

public final void
setToggleNoView(boolean
The new toggleNoView flag.
toggleNoView
)

Set the toggleNoView flag.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

annotback to summary
protected final COSDictionary annot

Annotation dictionary.

FLAG_HIDDENback to summary
private static final int FLAG_HIDDEN

An annotation flag.

FLAG_INVISIBLEback to summary
private static final int FLAG_INVISIBLE

An annotation flag.

FLAG_LOCKEDback to summary
private static final int FLAG_LOCKED

An annotation flag.

FLAG_LOCKED_CONTENTSback to summary
private static final int FLAG_LOCKED_CONTENTS

An annotation flag.

FLAG_NO_ROTATEback to summary
private static final int FLAG_NO_ROTATE

An annotation flag.

FLAG_NO_VIEWback to summary
private static final int FLAG_NO_VIEW

An annotation flag.

FLAG_NO_ZOOMback to summary
private static final int FLAG_NO_ZOOM

An annotation flag.

FLAG_PRINTEDback to summary
private static final int FLAG_PRINTED

An annotation flag.

FLAG_READ_ONLYback to summary
private static final int FLAG_READ_ONLY

An annotation flag.

FLAG_TOGGLE_NO_VIEWback to summary
private static final int FLAG_TOGGLE_NO_VIEW

An annotation flag.

LOGback to summary
private static final Log LOG

Constructor Detail

FDFAnnotationback to summary
public FDFAnnotation()

Default constructor.

FDFAnnotationback to summary
public FDFAnnotation(COSDictionary a)

Constructor.

Parameters
a:COSDictionary

The FDF annotation.

FDFAnnotationback to summary
public FDFAnnotation(Element element) throws IOException

Constructor.

Parameters
element:Element

An XFDF element.

Exceptions
IOException:
If there is an error extracting data from the element.

Method Detail

createback to summary
public static FDFAnnotation create(COSDictionary fdfDic)

Create the correct FDFAnnotation.

Parameters
fdfDic:COSDictionary

The FDF dictionary.

Returns:FDFAnnotation

A newly created FDFAnnotation

getBorderEffectback to summary
public PDBorderEffectDictionary getBorderEffect()

This will retrieve the border style dictionary, describing the effect applied to the border described by the BS entry.

Returns:PDBorderEffectDictionary

the border effect dictionary.

getBorderStyleback to summary
public PDBorderStyleDictionary getBorderStyle()

This will retrieve the border style dictionary, specifying the width and dash pattern used in drawing the annotation.

Returns:PDBorderStyleDictionary

the border style dictionary.

getColorback to summary
public Color getColor()

Get the annotation color.

Returns:Color

The annotation color, or null if there is none.

getContentsback to summary
public String getContents()

Get the text, or a description, of the annotation.

Returns:String

The text, or a description, of the annotation.

getCOSObjectback to summary
public COSDictionary getCOSObject()

Implements org.apache.pdfbox.pdmodel.common.COSObjectable.getCOSObject.

Convert this standard java object to a COS object.

Returns:COSDictionary

The cos object that matches this Java object.

Annotations
@Override
getCreationDateback to summary
public Calendar getCreationDate() throws IOException

The annotation create date.

Returns:Calendar

The date of the creation of the annotation date

Exceptions
IOException:
If there is an error converting the string to a Calendar object.
getDateback to summary
public String getDate()

Modification date.

Returns:String

The date as a string.

getIntentback to summary
public String getIntent()

Get the intent of the annotation.

Returns:String

The intent of the annotation.

getNameback to summary
public String getName()

Get the annotation name.

Returns:String

The unique name of the annotation.

getOpacityback to summary
public float getOpacity()

Get the opacity value.

Returns:float

The opacity of the annotation.

getPageback to summary
public Integer getPage()

This will get the page number or null if it does not exist.

Returns:Integer

The page number.

getRectangleback to summary
public PDRectangle getRectangle()

The rectangle associated with this annotation.

Returns:PDRectangle

The annotation rectangle.

getRichContentsback to summary
public String getRichContents()

This will retrieve the rich text stream which is displayed in the popup window.

Returns:String

the rich text stream.

getStringOrStreamback to summary
protected final String getStringOrStream(COSBase base)

Get a text or text stream. Some dictionary entries allow either a text or a text stream.

Parameters
base:COSBase

the potential text or text stream

Returns:String

the text stream

getSubjectback to summary
public String getSubject()

Get the description of the annotation.

Returns:String

The subject of the annotation.

getTitleback to summary
public String getTitle()

Get the annotation title.

Returns:String

The title of the annotation.

isHiddenback to summary
public boolean isHidden()

Get the hidden flag.

Returns:boolean

The hidden flag.

isInvisibleback to summary
public boolean isInvisible()

Get the invisible flag.

Returns:boolean

The invisible flag.

isLockedback to summary
public boolean isLocked()

Get the locked flag.

Returns:boolean

The locked flag.

isLockedContentsback to summary
public boolean isLockedContents()

Get the LockedContents flag.

Returns:boolean

The LockedContents flag.

isNoRotateback to summary
public boolean isNoRotate()

Get the noRotate flag.

Returns:boolean

The noRotate flag.

isNoViewback to summary
public boolean isNoView()

Get the noView flag.

Returns:boolean

The noView flag.

isNoZoomback to summary
public boolean isNoZoom()

Get the noZoom flag.

Returns:boolean

The noZoom flag.

isPrintedback to summary
public boolean isPrinted()

Get the printed flag.

Returns:boolean

The printed flag.

isReadOnlyback to summary
public boolean isReadOnly()

Get the readOnly flag.

Returns:boolean

The readOnly flag.

isToggleNoViewback to summary
public boolean isToggleNoView()

Get the toggleNoView flag.

Returns:boolean

The toggleNoView flag.

richContentsToStringback to summary
private String richContentsToString(Node node, boolean root)
setBorderEffectback to summary
public final void setBorderEffect(PDBorderEffectDictionary be)

This will set the border effect dictionary, describing the effect applied to the border described by the BS entry.

Parameters
be:PDBorderEffectDictionary

the border effect dictionary to set.

setBorderStyleback to summary
public final void setBorderStyle(PDBorderStyleDictionary bs)

This will set the border style dictionary, specifying the width and dash pattern used in drawing the annotation.

Parameters
bs:PDBorderStyleDictionary

the border style dictionary to set.

setColorback to summary
public final void setColor(Color c)

Set the annotation color.

Parameters
c:Color

The annotation color.

setContentsback to summary
public final void setContents(String contents)

Set the contents, or a description, for an annotation.

Parameters
contents:String

The annotation contents, or a description.

setCreationDateback to summary
public final void setCreationDate(Calendar date)

Set the creation date.

Parameters
date:Calendar

The date the annotation was created.

setDateback to summary
public final void setDate(String date)

The annotation modification date.

Parameters
date:String

The date to store in the FDF annotation.

setHiddenback to summary
public final void setHidden(boolean hidden)

Set the hidden flag.

Parameters
hidden:boolean

The new hidden flag.

setIntentback to summary
public final void setIntent(String intent)

The intent of the annotation.

Parameters
intent:String

The annotation's intent.

setInvisibleback to summary
public final void setInvisible(boolean invisible)

Set the invisible flag.

Parameters
invisible:boolean

The new invisible flag.

setLockedback to summary
public final void setLocked(boolean locked)

Set the locked flag.

Parameters
locked:boolean

The new locked flag.

setLockedContentsback to summary
public void setLockedContents(boolean lockedContents)

Set the LockedContents flag.

Parameters
lockedContents:boolean

The new LockedContents flag.

setNameback to summary
public final void setName(String name)

Set a unique name for an annotation.

Parameters
name:String

The unique annotation name.

setNoRotateback to summary
public final void setNoRotate(boolean noRotate)

Set the noRotate flag.

Parameters
noRotate:boolean

The new noRotate flag.

setNoViewback to summary
public final void setNoView(boolean noView)

Set the noView flag.

Parameters
noView:boolean

The new noView flag.

setNoZoomback to summary
public final void setNoZoom(boolean noZoom)

Set the noZoom flag.

Parameters
noZoom:boolean

The new noZoom flag.

setOpacityback to summary
public final void setOpacity(float opacity)

Set the annotation opacity.

Parameters
opacity:float

The new opacity value.

setPageback to summary
public final void setPage(int page)

This will set the page.

Parameters
page:int

The page number.

setPrintedback to summary
public final void setPrinted(boolean printed)

Set the printed flag.

Parameters
printed:boolean

The new printed flag.

setReadOnlyback to summary
public final void setReadOnly(boolean readOnly)

Set the readOnly flag.

Parameters
readOnly:boolean

The new readOnly flag.

setRectangleback to summary
public final void setRectangle(PDRectangle rectangle)

Set the rectangle associated with this annotation.

Parameters
rectangle:PDRectangle

The annotation rectangle.

setRichContentsback to summary
public final void setRichContents(String rc)

This will set the rich text stream which is displayed in the popup window.

Parameters
rc:String

the rich text stream.

setSubjectback to summary
public final void setSubject(String subject)

A short description of the annotation.

Parameters
subject:String

The annotation subject.

setTitleback to summary
public final void setTitle(String title)

Set a unique title for an annotation.

Parameters
title:String

The annotation title.

setToggleNoViewback to summary
public final void setToggleNoView(boolean toggleNoView)

Set the toggleNoView flag.

Parameters
toggleNoView:boolean

The new toggleNoView flag.