com.snowtide.pdf.annot
Class LinkAnnotation

java.lang.Object
  extended by com.snowtide.pdf.annot.BaseAnnotation
      extended by com.snowtide.pdf.annot.LinkAnnotation
All Implemented Interfaces:
Annotation

public class LinkAnnotation
extends com.snowtide.pdf.annot.BaseAnnotation

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 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 getPreviousURI() function.

If 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 BaseAnnotation.getPageNumber() function; the area that should be shown on that page when the link annotation is activated is given by the getTopBound(), getBottomBound(), getLeftBound(), and getRightBound() functions.

Since:
v1.3.5
Version:
©2004-2012 Snowtide Informatics Systems, Inc.

Constructor Summary
LinkAnnotation()
           
 
Method Summary
 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'.
 
Methods inherited from class com.snowtide.pdf.annot.BaseAnnotation
getContents, getModificationDate, getName, getPageNumber, getRect, getTypeCd, readPageAnnotations
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinkAnnotation

public LinkAnnotation()
Method Detail

getPreviousURI

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.


getURI

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'.


getLinkActionName

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. PDFTextStream supports the following types of link actions:

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


getTargetPageNumber

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 PDFTextStream instance's PDFTextStream.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.


getLeftBound

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.


getRightBound

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.


getTopBound

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.


getBottomBound

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.