These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Setting properties of links throughout a document

StevenD
Registered: Oct 6 2006
Posts: 368
Answered

Is it possible to change the properties of all links in a document such as border color and whether they are boxes or underlines?
 
I have looked at examples of how to create links using addLink and set thier properties when each link is created but I'm not seeing just how to access a link that allready exists.
 
Can anyone point me in a direction on how to set link properties?

StevenD

My Product Information:
Acrobat Pro Extended 9.4, Windows
UVSAR
Online
Expert
Registered: Oct 29 2008
Posts: 1357
Accepted Answer
Yes you can (it's just the link's action which is hard to control with scripting):


for ( var p = 0; p < this.numPages; p++) {
var b = this.getPageBox("Crop", p);
var links = this.getLinks(p, b);
for (var a in links) {
links[a].borderColor = color.blue;
links[a].borderWidth = 1;
links[a].highlightMode = "Outline";
}
}

Note that in Acrobat a link can have a rectangular border or not, and an on-click highlight or not, but it cannot have an underline - that's something created by the original authoring application.
StevenD
Registered: Oct 6 2006
Posts: 368
Thanks very much. That works. It appears then that I'm not able to programatically set the border style or Line Style of a link to Underline like I can do via the UI. It appears that I can give a text field or button an underline border with a JavaScipt. At this point it looks like I would have to select all links on a page using the Select Object tool and change the border to an underline via the Line Style in the Link Properties.


StevenD

UVSAR
Online
Expert
Registered: Oct 29 2008
Posts: 1357
Correct - Acrobat's UI or the application creating the PDF (such as InDesign) can create an "underline" border but the JS API cannot.