public class LinkAnnotation
extends java.lang.Object
An Annotation
implementation that represents
a PDF annotation of type Link
.
Link annotations can refer to a particular location within a PDF document or to an external
URI (typically used for web hyperlinks). (Other link action types
are
available within the PDF specification, but they are generally not relevent outside of a graphical PDF
viewer such as Acrobat.
When referring to an external URI, that URI is available through the LinkAnnotation.getURI()
function.
In addition, if a link annotation has been edited or modified by a Web Capture process, any previous
URI value is moved so that it is available through the LinkAnnotation.getPreviousURI()
function.
If LinkAnnotation.getURI()
returns null, then a link annotation refers to a location within a PDF document.
The page number is indicated by the return value of the pageNumber()
function; the area that
should be shown on that page when the link annotation is activated is given by the LinkAnnotation.getTopBound()
,
LinkAnnotation.getBottomBound()
, LinkAnnotation.getLeftBound()
, and LinkAnnotation.getRightBound()
functions.
Constructor and Description |
---|
LinkAnnotation() |
Modifier and Type | Method and Description |
---|---|
float |
getBottomBound()
Returns the y-coordinate on the page to which this link annotation refers where a
PDF viewer should position the bottom edge of its window when the link annotation is activated.
|
float |
getLeftBound()
Returns the x-coordinate on the page to which this link annotation refers where a
PDF viewer should position the left edge of its window when the link annotation is activated.
|
java.lang.String |
getLinkActionName()
Returns the name of the type of action that this link annotation will perform when a user activates
it within a PDF viewer.
|
java.lang.String |
getPreviousURI()
Returns the previous URI to which this link annotation referred.
|
float |
getRightBound()
Returns the x-coordinate on the page to which this link annotation refers where a
PDF viewer should position the right edge of its window when the link annotation is activated.
|
int |
getTargetPageNumber()
Returns the page number to which this link annotation refers.
|
float |
getTopBound()
Returns the y-coordinate on the page to which this link annotation refers where a
PDF viewer should position the top edge of its window when the link annotation is activated.
|
java.lang.String |
getURI()
Returns the URI to which this link annotation refers; this will be non-null only if this
link's annotation action type is 'URI'. |
getAppearance, getContents, getModificationDate, getName, getTypeCd
pageNumber
public java.lang.String getPreviousURI()
Returns the previous URI to which this link annotation referred.
This attribute will be set if a Web Capture process changes the action associated with a link annotation from going to a URI to jumping to a page and location within the PDF document. When this happens, the original URI is set as the 'previous URI' attribute, and can be used as a backup or alternate destination for this link annotation.
public java.lang.String getURI()
Returns the URI to which this link annotation refers; this will be non-null only if this
link's annotation action type
is 'URI'.
public java.lang.String getLinkActionName()
Returns the name of the type of action that this link annotation will perform when a user activates it within a PDF viewer. PDFxStream supports the following types of link actions:
GoTo
- refers to a particular page (and perhaps region of a page)URI
- opens a URI in the user's browser
Other link action types are related to the display or manuipulation of multimedia and file data that is only relevant within the context of a graphical PDF viewer. These include:
GoToR
GoToE
Launch
Thread
Sound
Movie
Hide
Named
SubmitForm
ResetForm
ImportData
JavaScript
SetOCGState
Rendition
Trans
GoTo3DView
public int getTargetPageNumber()
Returns the page number to which this link annotation refers. The page number is 0-based, and
can be used to access the corresponding page object via the parent
Document
's Document.getPage(int)
method.
This function will return -1 if no page number is specified for this link or if this
link's annotation action type
is GoTo.
public float getLeftBound()
Returns the x-coordinate on the page to which this link annotation refers where a PDF viewer should position the left edge of its window when the link annotation is activated.
This function will return -1 if the bound coordinate is unspecified for this link or if this
link's annotation action type
is GoTo.
public float getRightBound()
Returns the x-coordinate on the page to which this link annotation refers where a PDF viewer should position the right edge of its window when the link annotation is activated.
This function will return -1 if the bound coordinate is unspecified for this link or if this
link's annotation action type
is GoTo.
public float getTopBound()
Returns the y-coordinate on the page to which this link annotation refers where a PDF viewer should position the top edge of its window when the link annotation is activated.
This function will return -1 if the bound coordinate is unspecified for this link or if this
link's annotation action type
is GoTo.
public float getBottomBound()
Returns the y-coordinate on the page to which this link annotation refers where a PDF viewer should position the bottom edge of its window when the link annotation is activated.
This function will return -1 if the bound coordinate is unspecified for this link or if this
link's annotation action type
is GoTo.