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

add a javascript action to a link

bebarth
Registered: Sep 6 2011
Posts: 2
Answered

I have a pdf file with a lot of links, but these links display pages at different size of zoom.
I would like add a javascript action to all these links.
the script below is written for the current page, but the action remove the one setting the target page.
How can I add a second action???
Thanks to let me know.
  
var linkPage = this.pageNum;
var box = this.getPageBox("Crop", linkPage); // get the page box
var linksList = this.getLinks(linkPage, box); // get the link
if (linksList.length > 0)
{
for (var i=0; i < linksList.length; i++) // loop through each link
{
linksList.setAction(this.zoomType=zoomtype.fitP;")
}
}

bebarth

My Product Information:
Acrobat Pro 9.4.3, Macintosh
try67
Expert
Registered: Oct 30 2008
Posts: 2398
Accepted Answer
It can't be done with a JavaScript inside of Acrobat.
The only way you can do it is with an external tool that could read the current script and add the new code to it.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

bebarth
Registered: Sep 6 2011
Posts: 2
thank you for your answer!
what kind of external tool do you speak about?

bebarth

try67
Expert
Registered: Oct 30 2008
Posts: 2398
It will need to be a custom tool, written in something like Java or C#.
If you wish, contact me personally via email (see my signature) and we could discuss the details of it.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com