Class PDAnnotationLink
- java.lang.Object
-
- org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation
-
- org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationLink
-
- All Implemented Interfaces:
COSObjectable
public class PDAnnotationLink extends PDAnnotation
This is the class that represents a link annotation.
-
-
Field Summary
Fields Modifier and Type Field Description private PDAppearanceHandler
customAppearanceHandler
static java.lang.String
HIGHLIGHT_MODE_INVERT
Constant values of the Text as defined in the PDF 1.6 reference Table 8.19.static java.lang.String
HIGHLIGHT_MODE_NONE
Constant values of the Text as defined in the PDF 1.6 reference Table 8.19.static java.lang.String
HIGHLIGHT_MODE_OUTLINE
Constant values of the Text as defined in the PDF 1.6 reference Table 8.19.static java.lang.String
HIGHLIGHT_MODE_PUSH
Constant values of the Text as defined in the PDF 1.6 reference Table 8.19.static java.lang.String
SUB_TYPE
The type of annotation.
-
Constructor Summary
Constructors Constructor Description PDAnnotationLink()
Constructor.PDAnnotationLink(COSDictionary field)
Creates a Link 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.PDAction
getAction()
Get the action to be performed when this annotation is to be activated.PDBorderStyleDictionary
getBorderStyle()
This will retrieve the border style dictionary, specifying the width and dash pattern used in drawing the line.PDDestination
getDestination()
Get the destination to be displayed when the annotation is activated.java.lang.String
getHighlightMode()
Set the highlight mode for when the mouse is depressed.PDActionURI
getPreviousURI()
This will set the previous URI action, in case it's needed.float[]
getQuadPoints()
This will retrieve the set of quadpoints which encompass the areas of this annotation which will activate.void
setAction(PDAction action)
Set the annotation action.void
setBorderStyle(PDBorderStyleDictionary bs)
This will set the border style dictionary, specifying the width and dash pattern used in drawing the line.void
setCustomAppearanceHandler(PDAppearanceHandler appearanceHandler)
Set a custom appearance handler for generating the annotations appearance streams.void
setDestination(PDDestination dest)
The new destination value.void
setHighlightMode(java.lang.String mode)
Set the highlight mode.void
setPreviousURI(PDActionURI pa)
This will set the previous URI action, in case it needs to be retrieved at later date.void
setQuadPoints(float[] quadPoints)
This will set the set of quadpoints which encompass the areas of this annotation which will activate.-
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
-
HIGHLIGHT_MODE_NONE
public static final java.lang.String HIGHLIGHT_MODE_NONE
Constant values of the Text as defined in the PDF 1.6 reference Table 8.19.- See Also:
- Constant Field Values
-
HIGHLIGHT_MODE_INVERT
public static final java.lang.String HIGHLIGHT_MODE_INVERT
Constant values of the Text as defined in the PDF 1.6 reference Table 8.19.- See Also:
- Constant Field Values
-
HIGHLIGHT_MODE_OUTLINE
public static final java.lang.String HIGHLIGHT_MODE_OUTLINE
Constant values of the Text as defined in the PDF 1.6 reference Table 8.19.- See Also:
- Constant Field Values
-
HIGHLIGHT_MODE_PUSH
public static final java.lang.String HIGHLIGHT_MODE_PUSH
Constant values of the Text as defined in the PDF 1.6 reference Table 8.19.- 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
-
PDAnnotationLink
public PDAnnotationLink()
Constructor.
-
PDAnnotationLink
public PDAnnotationLink(COSDictionary field)
Creates a Link annotation from a COSDictionary, expected to be a correct object definition.- Parameters:
field
- the PDF object to represent as a field.
-
-
Method Detail
-
getAction
public PDAction getAction()
Get the action to be performed when this annotation is to be activated. Either this or the destination entry should be set, but not both.- Returns:
- The action to be performed when this annotation is activated.
-
setAction
public void setAction(PDAction action)
Set the annotation action. Either this or the destination entry should be set, but not both.- Parameters:
action
- The annotation action.
-
setBorderStyle
public void setBorderStyle(PDBorderStyleDictionary bs)
This will set the border style dictionary, specifying the width and dash pattern used in drawing the line.- 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 line.- Returns:
- the border style dictionary.
-
getDestination
public PDDestination getDestination() throws java.io.IOException
Get the destination to be displayed when the annotation is activated. Either this or the action entry should be set, but not both.- Returns:
- The destination for this annotation.
- Throws:
java.io.IOException
- If there is an error creating the destination.
-
setDestination
public void setDestination(PDDestination dest)
The new destination value. Either this or the action entry should be set, but not both.- Parameters:
dest
- The updated destination.
-
getHighlightMode
public java.lang.String getHighlightMode()
Set the highlight mode for when the mouse is depressed. See the HIGHLIGHT_MODE_XXX constants.- Returns:
- The string representation of the highlight mode.
-
setHighlightMode
public void setHighlightMode(java.lang.String mode)
Set the highlight mode. See the HIGHLIGHT_MODE_XXX constants.- Parameters:
mode
- The new highlight mode.
-
setPreviousURI
public void setPreviousURI(PDActionURI pa)
This will set the previous URI action, in case it needs to be retrieved at later date.- Parameters:
pa
- The previous URI.
-
getPreviousURI
public PDActionURI getPreviousURI()
This will set the previous URI action, in case it's needed.- Returns:
- The previous URI.
-
setQuadPoints
public void setQuadPoints(float[] quadPoints)
This will set the set of quadpoints which encompass the areas of this annotation which will activate.- Parameters:
quadPoints
- an array representing the set of area covered.
-
getQuadPoints
public float[] getQuadPoints()
This will retrieve the set of quadpoints which encompass the areas of this annotation which will activate.- Returns:
- An array of floats representing the quad points.
-
setCustomAppearanceHandler
public void setCustomAppearanceHandler(PDAppearanceHandler appearanceHandler)
Set a custom appearance handler for generating the annotations appearance streams.- 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 classPDAnnotation
-
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 classPDAnnotation
-
-