Class PdfLinkAnnotation
- java.lang.Object
-
- com.itextpdf.kernel.pdf.PdfObjectWrapper<PdfDictionary>
-
- com.itextpdf.kernel.pdf.annot.PdfAnnotation
-
- com.itextpdf.kernel.pdf.annot.PdfLinkAnnotation
-
public class PdfLinkAnnotation extends PdfAnnotation
A link annotation represents either a hypertext link to a destination elsewhere in the document or anPdfAction
to be performed. See also ISO-320001 12.5.6.5, "Link Annotations".
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.itextpdf.kernel.pdf.annot.PdfAnnotation
PdfAnnotation.PdfUnknownAnnotation
-
-
Field Summary
Fields Modifier and Type Field Description static PdfName
Invert
private static org.slf4j.Logger
logger
static PdfName
None
Highlight modes.static PdfName
Outline
static PdfName
Push
-
Fields inherited from class com.itextpdf.kernel.pdf.annot.PdfAnnotation
Accepted, Canceled, Completed, HIDDEN, HIGHLIGHT_INVERT, HIGHLIGHT_NONE, HIGHLIGHT_OUTLINE, HIGHLIGHT_PUSH, HIGHLIGHT_TOGGLE, INVISIBLE, LOCKED, LOCKED_CONTENTS, Marked, MarkedModel, NO_ROTATE, NO_VIEW, NO_ZOOM, page, PRINT, READ_ONLY, Rejected, ReviewModel, STYLE_BEVELED, STYLE_DASHED, STYLE_INSET, STYLE_SOLID, STYLE_UNDERLINE, TOGGLE_NO_VIEW, Unmarked
-
-
Constructor Summary
Constructors Modifier Constructor Description PdfLinkAnnotation(Rectangle rect)
Creates a newPdfLinkAnnotation
instance based onRectangle
instance, that define the location of the annotation on the page in default user space units.protected
PdfLinkAnnotation(PdfDictionary pdfObject)
Creates a newPdfLinkAnnotation
instance based onPdfDictionary
instance, that represents existing annotation object in the document.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PdfDictionary
getAction()
AnPdfAction
to perform, such as launching an application, playing a sound, changing an annotation’s appearance state etc, when the annotation is activated.PdfDictionary
getBorderStyle()
BS entry specifies a border style dictionary that has more settings than the array specified for the Border entry (seePdfAnnotation.getBorder()
).PdfObject
getDestinationObject()
Gets the annotation destination asPdfObject
instance.PdfName
getHighlightMode()
Gets the annotation highlight mode.PdfArray
getQuadPoints()
An array of 8 × n numbers specifying the coordinates of n quadrilaterals in default user space.PdfName
getSubtype()
Gets aPdfName
which value is a subtype of this annotation.PdfDictionary
getUriActionObject()
Gets the annotation URI action asPdfDictionary
.PdfLinkAnnotation
removeAction()
Removes aPdfAction
from this annotation.PdfLinkAnnotation
removeDestination()
Removes the annotation destination.PdfLinkAnnotation
setAction(PdfAction action)
Sets aPdfAction
to this annotation which will be performed when the annotation is activated.PdfLinkAnnotation
setAction(PdfDictionary action)
Sets aPdfDictionary
representing action to this annotation which will be performed when the annotation is activated.PdfLinkAnnotation
setBorderStyle(PdfDictionary borderStyle)
Sets border style dictionary that has more settings than the array specified for the Border entry (PdfAnnotation.getBorder()
).PdfLinkAnnotation
setBorderStyle(PdfName style)
Setter for the annotation's preset border style.PdfLinkAnnotation
setDashPattern(PdfArray dashPattern)
Setter for the annotation's preset dashed border style.PdfLinkAnnotation
setDestination(PdfDestination destination)
Sets the annotation destination asPdfDestination
instance.PdfLinkAnnotation
setDestination(PdfObject destination)
Sets the annotation destination asPdfObject
instance.PdfLinkAnnotation
setHighlightMode(PdfName hlMode)
Sets the annotation highlight mode.PdfLinkAnnotation
setQuadPoints(PdfArray quadPoints)
Sets n quadrilaterals in default user space by passing anPdfArray
of 8 × n numbers.PdfLinkAnnotation
setUriAction(PdfAction action)
Sets the annotation URI action asPdfAction
instance.PdfLinkAnnotation
setUriAction(PdfDictionary action)
Sets the annotation URI action asPdfDictionary
instance.-
Methods inherited from class com.itextpdf.kernel.pdf.annot.PdfAnnotation
addAssociatedFile, flush, getAppearanceDictionary, getAppearanceObject, getAppearanceState, getAssociatedFiles, getBlendMode, getBorder, getColorObject, getContents, getDate, getDownAppearanceObject, getFlags, getLang, getName, getNonStrokingOpacity, getNormalAppearanceObject, getPage, getPageObject, getRectangle, getRolloverAppearanceObject, getStrokingOpacity, getStructParentIndex, getTitle, hasFlag, isWrappedObjectMustBeIndirect, makeAnnotation, put, remove, resetFlag, setAppearance, setAppearance, setAppearanceState, setBlendMode, setBorder, setBorder, setColor, setColor, setColor, setContents, setContents, setDate, setDownAppearance, setDownAppearance, setFlag, setFlags, setLang, setLayer, setName, setNonStrokingOpacity, setNormalAppearance, setNormalAppearance, setPage, setRectangle, setRolloverAppearance, setRolloverAppearance, setStrokingOpacity, setStructParentIndex, setTitle
-
Methods inherited from class com.itextpdf.kernel.pdf.PdfObjectWrapper
ensureObjectIsAddedToDocument, ensureUnderlyingObjectHasIndirectReference, getPdfObject, isFlushed, makeIndirect, makeIndirect, markObjectAsIndirect, setForbidRelease, setModified, setPdfObject, unsetForbidRelease
-
-
-
-
Constructor Detail
-
PdfLinkAnnotation
protected PdfLinkAnnotation(PdfDictionary pdfObject)
Creates a newPdfLinkAnnotation
instance based onPdfDictionary
instance, that represents existing annotation object in the document.- Parameters:
pdfObject
- thePdfDictionary
representing annotation object- See Also:
PdfAnnotation.makeAnnotation(PdfObject)
-
PdfLinkAnnotation
public PdfLinkAnnotation(Rectangle rect)
Creates a newPdfLinkAnnotation
instance based onRectangle
instance, that define the location of the annotation on the page in default user space units.- Parameters:
rect
- theRectangle
that define the location of the annotation
-
-
Method Detail
-
getSubtype
public PdfName getSubtype()
Description copied from class:PdfAnnotation
Gets aPdfName
which value is a subtype of this annotation. See ISO-320001 12.5.6, "Annotation Types" for the reference to the possible types.- Specified by:
getSubtype
in classPdfAnnotation
- Returns:
- subtype of this annotation.
-
getDestinationObject
public PdfObject getDestinationObject()
Gets the annotation destination asPdfObject
instance.Destination shall be displayed when the annotation is activated. See also ISO-320001, Table 173.
- Returns:
- the annotation destination as
PdfObject
instance
-
setDestination
public PdfLinkAnnotation setDestination(PdfObject destination)
Sets the annotation destination asPdfObject
instance.Destination shall be displayed when the annotation is activated. See also ISO-320001, Table 173.
- Parameters:
destination
- the destination to be set asPdfObject
instance- Returns:
- this
PdfLinkAnnotation
instance
-
setDestination
public PdfLinkAnnotation setDestination(PdfDestination destination)
Sets the annotation destination asPdfDestination
instance.Destination shall be displayed when the annotation is activated. See also ISO-320001, Table 173.
- Parameters:
destination
- the destination to be set asPdfDestination
instance- Returns:
- this
PdfLinkAnnotation
instance
-
removeDestination
public PdfLinkAnnotation removeDestination()
Removes the annotation destination.Destination shall be displayed when the annotation is activated. See also ISO-320001, Table 173.
- Returns:
- this
PdfLinkAnnotation
instance
-
getAction
public PdfDictionary getAction()
AnPdfAction
to perform, such as launching an application, playing a sound, changing an annotation’s appearance state etc, when the annotation is activated.- Returns:
PdfDictionary
which defines the characteristics and behaviour of an action
-
setAction
public PdfLinkAnnotation setAction(PdfDictionary action)
Sets aPdfDictionary
representing action to this annotation which will be performed when the annotation is activated.- Parameters:
action
-PdfDictionary
that represents action to set to this annotation- Returns:
- this
PdfLinkAnnotation
instance
-
setAction
public PdfLinkAnnotation setAction(PdfAction action)
Sets aPdfAction
to this annotation which will be performed when the annotation is activated.- Parameters:
action
-PdfAction
to set to this annotation- Returns:
- this
PdfLinkAnnotation
instance
-
removeAction
public PdfLinkAnnotation removeAction()
Removes aPdfAction
from this annotation.- Returns:
- this
PdfLinkAnnotation
instance
-
getHighlightMode
public PdfName getHighlightMode()
Gets the annotation highlight mode.The annotation’s highlighting mode is the visual effect that shall be used when the mouse button is pressed or held down inside its active area. See also ISO-320001, Table 173.
- Returns:
- the name of visual effect
-
setHighlightMode
public PdfLinkAnnotation setHighlightMode(PdfName hlMode)
Sets the annotation highlight mode.The annotation’s highlighting mode is the visual effect that shall be used when the mouse button is pressed or held down inside its active area. See also ISO-320001, Table 173.
- Parameters:
hlMode
- the name of visual effect to be set- Returns:
- this
PdfLinkAnnotation
instance
-
getUriActionObject
public PdfDictionary getUriActionObject()
Gets the annotation URI action asPdfDictionary
.When Web Capture (see ISO-320001 14.10, “Web Capture”) changes an annotation from a URI to a go-to action, it uses this entry to save the data from the original URI action so that it can be changed back in case the target page for the go-to action is subsequently deleted. See also ISO-320001, Table 173.
- Returns:
- the URI action as pdfDictionary
-
setUriAction
public PdfLinkAnnotation setUriAction(PdfDictionary action)
Sets the annotation URI action asPdfDictionary
instance.When Web Capture (see ISO-320001 14.10, “Web Capture”) changes an annotation from a URI to a go-to action, it uses this entry to save the data from the original URI action so that it can be changed back in case the target page for the go-to action is subsequently deleted. See also ISO-320001, Table 173.
- Parameters:
action
- the action to be set- Returns:
- this
PdfLinkAnnotation
instance
-
setUriAction
public PdfLinkAnnotation setUriAction(PdfAction action)
Sets the annotation URI action asPdfAction
instance.A URI action (see ISO-320001 12.6.4.7, “URI Actions”) formerly associated with this annotation. When Web Capture (see ISO-320001 14.10, “Web Capture”) changes an annotation from a URI to a go-to action, it uses this entry to save the data from the original URI action so that it can be changed back in case the target page for the go-to action is subsequently deleted. See also ISO-320001, Table 173.
- Parameters:
action
- the action to be set- Returns:
- this
PdfLinkAnnotation
instance
-
getQuadPoints
public PdfArray getQuadPoints()
An array of 8 × n numbers specifying the coordinates of n quadrilaterals in default user space. Quadrilaterals are used to define regions inside annotation rectangle in which the link annotation should be activated.- Returns:
- an
PdfArray
of 8 × n numbers specifying the coordinates of n quadrilaterals.
-
setQuadPoints
public PdfLinkAnnotation setQuadPoints(PdfArray quadPoints)
Sets n quadrilaterals in default user space by passing anPdfArray
of 8 × n numbers. Quadrilaterals are used to define regions inside annotation rectangle in which the link annotation should be activated.- Parameters:
quadPoints
- anPdfArray
of 8 × n numbers specifying the coordinates of n quadrilaterals.- Returns:
- this
PdfLinkAnnotation
instance.
-
getBorderStyle
public PdfDictionary getBorderStyle()
BS entry specifies a border style dictionary that has more settings than the array specified for the Border entry (seePdfAnnotation.getBorder()
). If an annotation dictionary includes the BS entry, then the Border entry is ignored. If annotation includes AP (seePdfAnnotation.getAppearanceDictionary()
) it takes precedence over the BS entry. For more info on BS entry see ISO-320001, Table 166.- Returns:
PdfDictionary
which is a border style dictionary or null if it is not specified.
-
setBorderStyle
public PdfLinkAnnotation setBorderStyle(PdfDictionary borderStyle)
Sets border style dictionary that has more settings than the array specified for the Border entry (PdfAnnotation.getBorder()
). See ISO-320001, Table 166 andgetBorderStyle()
for more info.- Parameters:
borderStyle
- a border style dictionary specifying the line width and dash pattern that shall be used in drawing the annotation’s border.- Returns:
- this
PdfLinkAnnotation
instance.
-
setBorderStyle
public PdfLinkAnnotation setBorderStyle(PdfName style)
Setter for the annotation's preset border style. Possible values arePdfAnnotation.STYLE_SOLID
- A solid rectangle surrounding the annotation.PdfAnnotation.STYLE_DASHED
- A dashed rectangle surrounding the annotation.PdfAnnotation.STYLE_BEVELED
- A simulated embossed rectangle that appears to be raised above the surface of the page.PdfAnnotation.STYLE_INSET
- A simulated engraved rectangle that appears to be recessed below the surface of the page.PdfAnnotation.STYLE_UNDERLINE
- A single line along the bottom of the annotation rectangle.
- Parameters:
style
- The new value for the annotation's border style.- Returns:
- this
PdfLinkAnnotation
instance. - See Also:
getBorderStyle()
-
setDashPattern
public PdfLinkAnnotation setDashPattern(PdfArray dashPattern)
Setter for the annotation's preset dashed border style. This property has affect only ifPdfAnnotation.STYLE_DASHED
style was used for the annotation border style (seesetBorderStyle(PdfName)
. See ISO-320001 8.4.3.6, "Line Dash Pattern" for the format in which dash pattern shall be specified.- Parameters:
dashPattern
- a dash array defining a pattern of dashes and gaps that shall be used in drawing a dashed border.- Returns:
- this
PdfLinkAnnotation
instance.
-
-