Module org.sejda.sambox
Class PDAnnotationLink
java.lang.Object
org.sejda.sambox.pdmodel.common.PDDictionaryWrapper
org.sejda.sambox.pdmodel.interactive.annotation.PDAnnotation
org.sejda.sambox.pdmodel.interactive.annotation.PDAnnotationLink
- All Implemented Interfaces:
COSObjectable,WithActionOrDestination
This is the class that represents a link annotation.
- Author:
- Ben Litchfield, Paul King
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringConstant values of the Text as defined in the PDF 1.6 reference Table 8.19.static final StringConstant values of the Text as defined in the PDF 1.6 reference Table 8.19.static final StringConstant values of the Text as defined in the PDF 1.6 reference Table 8.19.static final StringConstant values of the Text as defined in the PDF 1.6 reference Table 8.19.static final StringThe type of annotation.Fields inherited from class org.sejda.sambox.pdmodel.interactive.annotation.PDAnnotation
FLAG_HIDDEN, FLAG_INVISIBLE, FLAG_LOCKED, FLAG_NO_ROTATE, FLAG_NO_VIEW, FLAG_NO_ZOOM, FLAG_PRINTED, FLAG_READ_ONLY, FLAG_TOGGLE_NO_VIEW -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.PDAnnotationLink(COSDictionary field) Creates a Link annotation from a COSDictionary, expected to be a correct object definition. -
Method Summary
Modifier and TypeMethodDescriptionvoidCreate the appearance entry for this annotation.Get the action to be performed when this annotation is to be activated.This will retrieve the border style dictionary, specifying the width and dash pattern used in drawing the line.Get the destination to be displayed when the annotation is activated.Set the highlight mode for when the mouse is depressed.This will set the previous URI action, in case it's needed.float[]This will retrieve the set of quadpoints which encompass the areas of this annotation which will activate.voidSet the annotation action.voidThis will set the border style dictionary, specifying the width and dash pattern used in drawing the line.voidsetCustomAppearanceHandler(PDAppearanceHandler appearanceHandler) Set a custom appearance handler for generating the annotations appearance streams.voidsetDestination(PDDestination dest) The new destination value.voidsetHighlightMode(String mode) Set the highlight mode.voidThis will set the previous URI action, in case it needs to be retrieved at later date.voidsetQuadPoints(float[] quadPoints) This will set the set of quadpoints which encompass the areas of this annotation which will activate.Methods inherited from class org.sejda.sambox.pdmodel.interactive.annotation.PDAnnotation
createAnnotation, createAnnotation, getAnnotationFlags, getAnnotationName, getAppearance, getAppearanceState, getBorder, getColor, getColor, getContents, getModifiedDate, getNormalAppearanceStream, getOptionalContent, getPage, getRectangle, getStructParent, getSubtype, 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, setToggleNoViewMethods inherited from class org.sejda.sambox.pdmodel.common.PDDictionaryWrapper
equals, getCOSObject, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.sejda.sambox.cos.COSObjectable
getCOSObjectMethods inherited from interface org.sejda.sambox.pdmodel.interactive.documentnavigation.destination.WithActionOrDestination
resolveToPageDestination
-
Field Details
-
HIGHLIGHT_MODE_NONE
Constant values of the Text as defined in the PDF 1.6 reference Table 8.19.- See Also:
-
HIGHLIGHT_MODE_INVERT
Constant values of the Text as defined in the PDF 1.6 reference Table 8.19.- See Also:
-
HIGHLIGHT_MODE_OUTLINE
Constant values of the Text as defined in the PDF 1.6 reference Table 8.19.- See Also:
-
HIGHLIGHT_MODE_PUSH
Constant values of the Text as defined in the PDF 1.6 reference Table 8.19.- See Also:
-
SUB_TYPE
The type of annotation.- See Also:
-
-
Constructor Details
-
PDAnnotationLink
public PDAnnotationLink()Constructor. -
PDAnnotationLink
Creates a Link annotation from a COSDictionary, expected to be a correct object definition.- Parameters:
field- the PDF objet to represent as a field.
-
-
Method Details
-
getAction
Get the action to be performed when this annotation is to be activated.- Specified by:
getActionin interfaceWithActionOrDestination- Returns:
- The action to be performed when this annotation is activated.
TODO not all annotations have an A entry
-
setAction
Set the annotation action. As of PDF 1.6 this is only used for Widget Annotations- Parameters:
action- The annotation action. TODO not all annotations have an A entry
-
setBorderStyle
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. TODO not all annotations may have a BS entry
-
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
Get the destination to be displayed when the annotation is activated. Either this or the A should be set but not both.- Specified by:
getDestinationin interfaceWithActionOrDestination- Returns:
- The destination for this annotation.
- Throws:
IOException- If there is an error creating the destination.
-
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
Set the highlight mode. See the HIGHLIGHT_MODE_XXX constants.- Parameters:
mode- The new highlight mode.
-
setPreviousURI
This will set the previous URI action, in case it needs to be retrieved at later date.- Parameters:
pa- The previous URI.
-
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
Set a custom appearance handler for generating the annotations appearance streams.- Parameters:
appearanceHandler-
-
constructAppearances
public void constructAppearances()Description copied from class:PDAnnotationCreate 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:
constructAppearancesin classPDAnnotation
-