Modifying the User Interface
Adding Navigation to PDF Documents
10
Links
Acrobat JavaScript provides support for the addition, customization, or removal of links
within PDF documents. These links may be used to access URLs, file attachments, or
destinations within the document.
The
doc
object contains methods for adding, retrieving, and removing links. These include
the methods listed below in
Table 10.8.
This is used in conjunction with the
link
object,
which contains properties as well as a
setAction
method for customizing the
appearance and behavior of a given link. Its properties are listed below in
Table 10.9.
In addition, the
app
object contains a property called
openInPlace
, which can be used
to specify whether cross-document links are opened in the same window or in a new one.
T
ABLE
10.8
Doc Object Link Methods
Method
Description
Adds a new link to a page
Converts text instances to Web links with URL actions
Retrieves the links within a specified area on a page
Opens a web page
Goes to a named destination within the document
Removes the links within a specifed area on a page
Removes Web links created with the Acrobat user
interface
addLink
addWeblinks
getLinks
getURL
gotoNamedDest
removeLinks
removeWeblinks
T
ABLE
10.9
Link Properties
Property
Description
The border color of the bounding rectangle
The border width of the surrounding rectangle
The visual effect when the user clicks the link
The rotated user space coordinates of the link
borderColor
borderWidth
highlightMode
rect
Acrobat JavaScript Scripting Guide
175