Package org.apache.pdfbox.pdmodel.fdf
Class FDFAnnotation
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.fdf.FDFAnnotation
-
- All Implemented Interfaces:
COSObjectable
- Direct Known Subclasses:
FDFAnnotationCaret
,FDFAnnotationCircle
,FDFAnnotationFileAttachment
,FDFAnnotationFreeText
,FDFAnnotationInk
,FDFAnnotationLine
,FDFAnnotationLink
,FDFAnnotationPolygon
,FDFAnnotationPolyline
,FDFAnnotationSound
,FDFAnnotationSquare
,FDFAnnotationStamp
,FDFAnnotationText
,FDFAnnotationTextMarkup
public abstract class FDFAnnotation extends java.lang.Object implements COSObjectable
This represents an FDF annotation that is part of the FDF document.
-
-
Field Summary
Fields Modifier and Type Field Description protected COSDictionary
annot
Annotation dictionary.private static int
FLAG_HIDDEN
An annotation flag.private static int
FLAG_INVISIBLE
An annotation flag.private static int
FLAG_LOCKED
An annotation flag.private static int
FLAG_LOCKED_CONTENTS
An annotation flag.private static int
FLAG_NO_ROTATE
An annotation flag.private static int
FLAG_NO_VIEW
An annotation flag.private static int
FLAG_NO_ZOOM
An annotation flag.private static int
FLAG_PRINTED
An annotation flag.private static int
FLAG_READ_ONLY
An annotation flag.private static int
FLAG_TOGGLE_NO_VIEW
An annotation flag.private static org.apache.commons.logging.Log
LOG
-
Constructor Summary
Constructors Constructor Description FDFAnnotation()
Default constructor.FDFAnnotation(COSDictionary a)
Constructor.FDFAnnotation(org.w3c.dom.Element element)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static FDFAnnotation
create(COSDictionary fdfDic)
Create the correct FDFAnnotation.PDBorderEffectDictionary
getBorderEffect()
This will retrieve the border style dictionary, describing the effect applied to the border described by the BS entry.PDBorderStyleDictionary
getBorderStyle()
This will retrieve the border style dictionary, specifying the width and dash pattern used in drawing the annotation.java.awt.Color
getColor()
Get the annotation color.java.lang.String
getContents()
Get the text, or a description, of the annotation.COSDictionary
getCOSObject()
Convert this standard java object to a COS object.java.util.Calendar
getCreationDate()
The annotation create date.java.lang.String
getDate()
Modification date.java.lang.String
getIntent()
Get the intent of the annotation.java.lang.String
getName()
Get the annotation name.float
getOpacity()
Get the opacity value.java.lang.Integer
getPage()
This will get the page number or null if it does not exist.PDRectangle
getRectangle()
The rectangle associated with this annotation.java.lang.String
getRichContents()
This will retrieve the rich text stream which is displayed in the popup window.protected java.lang.String
getStringOrStream(COSBase base)
Get a text or text stream.java.lang.String
getSubject()
Get the description of the annotation.java.lang.String
getTitle()
Get the annotation title.boolean
isHidden()
Get the hidden flag.boolean
isInvisible()
Get the invisible flag.boolean
isLocked()
Get the locked flag.boolean
isLockedContents()
Get the LockedContents flag.boolean
isNoRotate()
Get the noRotate flag.boolean
isNoView()
Get the noView flag.boolean
isNoZoom()
Get the noZoom flag.boolean
isPrinted()
Get the printed flag.boolean
isReadOnly()
Get the readOnly flag.boolean
isToggleNoView()
Get the toggleNoView flag.private java.lang.String
richContentsToString(org.w3c.dom.Node node, boolean root)
void
setBorderEffect(PDBorderEffectDictionary be)
This will set the border effect dictionary, describing the effect applied to the border described by the BS entry.void
setBorderStyle(PDBorderStyleDictionary bs)
This will set the border style dictionary, specifying the width and dash pattern used in drawing the annotation.void
setColor(java.awt.Color c)
Set the annotation color.void
setContents(java.lang.String contents)
Set the contents, or a description, for an annotation.void
setCreationDate(java.util.Calendar date)
Set the creation date.void
setDate(java.lang.String date)
The annotation modification date.void
setHidden(boolean hidden)
Set the hidden flag.void
setIntent(java.lang.String intent)
The intent of the annotation.void
setInvisible(boolean invisible)
Set the invisible flag.void
setLocked(boolean locked)
Set the locked flag.void
setLockedContents(boolean lockedContents)
Set the LockedContents flag.void
setName(java.lang.String name)
Set a unique name for an annotation.void
setNoRotate(boolean noRotate)
Set the noRotate flag.void
setNoView(boolean noView)
Set the noView flag.void
setNoZoom(boolean noZoom)
Set the noZoom flag.void
setOpacity(float opacity)
Set the annotation opacity.void
setPage(int page)
This will set the page.void
setPrinted(boolean printed)
Set the printed flag.void
setReadOnly(boolean readOnly)
Set the readOnly flag.void
setRectangle(PDRectangle rectangle)
Set the rectangle associated with this annotation.void
setRichContents(java.lang.String rc)
This will set the rich text stream which is displayed in the popup window.void
setSubject(java.lang.String subject)
A short description of the annotation.void
setTitle(java.lang.String title)
Set a unique title for an annotation.void
setToggleNoView(boolean toggleNoView)
Set the toggleNoView flag.
-
-
-
Field Detail
-
LOG
private static final org.apache.commons.logging.Log LOG
-
FLAG_INVISIBLE
private static final int FLAG_INVISIBLE
An annotation flag.- See Also:
- Constant Field Values
-
FLAG_HIDDEN
private static final int FLAG_HIDDEN
An annotation flag.- See Also:
- Constant Field Values
-
FLAG_PRINTED
private static final int FLAG_PRINTED
An annotation flag.- See Also:
- Constant Field Values
-
FLAG_NO_ZOOM
private static final int FLAG_NO_ZOOM
An annotation flag.- See Also:
- Constant Field Values
-
FLAG_NO_ROTATE
private static final int FLAG_NO_ROTATE
An annotation flag.- See Also:
- Constant Field Values
-
FLAG_NO_VIEW
private static final int FLAG_NO_VIEW
An annotation flag.- See Also:
- Constant Field Values
-
FLAG_READ_ONLY
private static final int FLAG_READ_ONLY
An annotation flag.- See Also:
- Constant Field Values
-
FLAG_LOCKED
private static final int FLAG_LOCKED
An annotation flag.- See Also:
- Constant Field Values
-
FLAG_TOGGLE_NO_VIEW
private static final int FLAG_TOGGLE_NO_VIEW
An annotation flag.- See Also:
- Constant Field Values
-
FLAG_LOCKED_CONTENTS
private static final int FLAG_LOCKED_CONTENTS
An annotation flag.- See Also:
- Constant Field Values
-
annot
protected COSDictionary annot
Annotation dictionary.
-
-
Constructor Detail
-
FDFAnnotation
public FDFAnnotation()
Default constructor.
-
FDFAnnotation
public FDFAnnotation(COSDictionary a)
Constructor.- Parameters:
a
- The FDF annotation.
-
FDFAnnotation
public FDFAnnotation(org.w3c.dom.Element element) throws java.io.IOException
Constructor.- Parameters:
element
- An XFDF element.- Throws:
java.io.IOException
- If there is an error extracting data from the element.
-
-
Method Detail
-
create
public static FDFAnnotation create(COSDictionary fdfDic) throws java.io.IOException
Create the correct FDFAnnotation.- Parameters:
fdfDic
- The FDF dictionary.- Returns:
- A newly created FDFAnnotation
- Throws:
java.io.IOException
- If there is an error accessing the FDF information.
-
getCOSObject
public COSDictionary getCOSObject()
Convert this standard java object to a COS object.- Specified by:
getCOSObject
in interfaceCOSObjectable
- Returns:
- The cos object that matches this Java object.
-
getPage
public java.lang.Integer getPage()
This will get the page number or null if it does not exist.- Returns:
- The page number.
-
setPage
public final void setPage(int page)
This will set the page.- Parameters:
page
- The page number.
-
getColor
public java.awt.Color getColor()
Get the annotation color.- Returns:
- The annotation color, or null if there is none.
-
setColor
public final void setColor(java.awt.Color c)
Set the annotation color.- Parameters:
c
- The annotation color.
-
getDate
public java.lang.String getDate()
Modification date.- Returns:
- The date as a string.
-
setDate
public final void setDate(java.lang.String date)
The annotation modification date.- Parameters:
date
- The date to store in the FDF annotation.
-
isInvisible
public boolean isInvisible()
Get the invisible flag.- Returns:
- The invisible flag.
-
setInvisible
public final void setInvisible(boolean invisible)
Set the invisible flag.- Parameters:
invisible
- The new invisible flag.
-
isHidden
public boolean isHidden()
Get the hidden flag.- Returns:
- The hidden flag.
-
setHidden
public final void setHidden(boolean hidden)
Set the hidden flag.- Parameters:
hidden
- The new hidden flag.
-
isPrinted
public boolean isPrinted()
Get the printed flag.- Returns:
- The printed flag.
-
setPrinted
public final void setPrinted(boolean printed)
Set the printed flag.- Parameters:
printed
- The new printed flag.
-
isNoZoom
public boolean isNoZoom()
Get the noZoom flag.- Returns:
- The noZoom flag.
-
setNoZoom
public final void setNoZoom(boolean noZoom)
Set the noZoom flag.- Parameters:
noZoom
- The new noZoom flag.
-
isNoRotate
public boolean isNoRotate()
Get the noRotate flag.- Returns:
- The noRotate flag.
-
setNoRotate
public final void setNoRotate(boolean noRotate)
Set the noRotate flag.- Parameters:
noRotate
- The new noRotate flag.
-
isNoView
public boolean isNoView()
Get the noView flag.- Returns:
- The noView flag.
-
setNoView
public final void setNoView(boolean noView)
Set the noView flag.- Parameters:
noView
- The new noView flag.
-
isReadOnly
public boolean isReadOnly()
Get the readOnly flag.- Returns:
- The readOnly flag.
-
setReadOnly
public final void setReadOnly(boolean readOnly)
Set the readOnly flag.- Parameters:
readOnly
- The new readOnly flag.
-
isLocked
public boolean isLocked()
Get the locked flag.- Returns:
- The locked flag.
-
setLocked
public final void setLocked(boolean locked)
Set the locked flag.- Parameters:
locked
- The new locked flag.
-
isToggleNoView
public boolean isToggleNoView()
Get the toggleNoView flag.- Returns:
- The toggleNoView flag.
-
setToggleNoView
public final void setToggleNoView(boolean toggleNoView)
Set the toggleNoView flag.- Parameters:
toggleNoView
- The new toggleNoView flag.
-
isLockedContents
public boolean isLockedContents()
Get the LockedContents flag.- Returns:
- The LockedContents flag.
-
setLockedContents
public void setLockedContents(boolean lockedContents)
Set the LockedContents flag.- Parameters:
lockedContents
- The new LockedContents flag.
-
setName
public final void setName(java.lang.String name)
Set a unique name for an annotation.- Parameters:
name
- The unique annotation name.
-
getName
public java.lang.String getName()
Get the annotation name.- Returns:
- The unique name of the annotation.
-
setRectangle
public final void setRectangle(PDRectangle rectangle)
Set the rectangle associated with this annotation.- Parameters:
rectangle
- The annotation rectangle.
-
getRectangle
public PDRectangle getRectangle()
The rectangle associated with this annotation.- Returns:
- The annotation rectangle.
-
setContents
public final void setContents(java.lang.String contents)
Set the contents, or a description, for an annotation.- Parameters:
contents
- The annotation contents, or a description.
-
getContents
public java.lang.String getContents()
Get the text, or a description, of the annotation.- Returns:
- The text, or a description, of the annotation.
-
setTitle
public final void setTitle(java.lang.String title)
Set a unique title for an annotation.- Parameters:
title
- The annotation title.
-
getTitle
public java.lang.String getTitle()
Get the annotation title.- Returns:
- The title of the annotation.
-
getCreationDate
public java.util.Calendar getCreationDate() throws java.io.IOException
The annotation create date.- Returns:
- The date of the creation of the annotation date
- Throws:
java.io.IOException
- If there is an error converting the string to a Calendar object.
-
setCreationDate
public final void setCreationDate(java.util.Calendar date)
Set the creation date.- Parameters:
date
- The date the annotation was created.
-
setOpacity
public final void setOpacity(float opacity)
Set the annotation opacity.- Parameters:
opacity
- The new opacity value.
-
getOpacity
public float getOpacity()
Get the opacity value.- Returns:
- The opacity of the annotation.
-
setSubject
public final void setSubject(java.lang.String subject)
A short description of the annotation.- Parameters:
subject
- The annotation subject.
-
getSubject
public java.lang.String getSubject()
Get the description of the annotation.- Returns:
- The subject of the annotation.
-
setIntent
public final void setIntent(java.lang.String intent)
The intent of the annotation.- Parameters:
intent
- The annotation's intent.
-
getIntent
public java.lang.String getIntent()
Get the intent of the annotation.- Returns:
- The intent of the annotation.
-
getRichContents
public java.lang.String getRichContents()
This will retrieve the rich text stream which is displayed in the popup window.- Returns:
- the rich text stream.
-
setRichContents
public final void setRichContents(java.lang.String rc)
This will set the rich text stream which is displayed in the popup window.- Parameters:
rc
- the rich text stream.
-
setBorderStyle
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
- the border style dictionary to set.
-
getBorderStyle
public PDBorderStyleDictionary getBorderStyle()
This will retrieve the border style dictionary, specifying the width and dash pattern used in drawing the annotation.- Returns:
- the border style dictionary.
-
setBorderEffect
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
- the border effect dictionary to set.
-
getBorderEffect
public PDBorderEffectDictionary getBorderEffect()
This will retrieve the border style dictionary, describing the effect applied to the border described by the BS entry.- Returns:
- the border effect dictionary.
-
getStringOrStream
protected final java.lang.String getStringOrStream(COSBase base)
Get a text or text stream. Some dictionary entries allow either a text or a text stream.- Parameters:
base
- the potential text or text stream- Returns:
- the text stream
-
richContentsToString
private java.lang.String richContentsToString(org.w3c.dom.Node node, boolean root)
-
-