3 Replies Latest reply on Mar 9, 2018 6:03 AM by try67

    Need help with Java script in Acrobat Pro (8.1)

    stevenburger Level 1

      Hello,

       

      I work for a company where I create user manuals for several different products. In one section of the manual I would like to create several hyperlinks at once that open different files on my hard drive. I am working a using a java script to automate this process as it is very time consuming (I need to make 30+ hyperlinks per manual). If I can find a way to get the script to work I can save countless hours per work on this tedious process.

       

      So for I have found how to use a Java script in adobe to generate the "Link" boxes where I need them to be. The code that I use to generate the boxes is below.

       

      var disp =11,pageNum = 6;

      var linkWidth = 470, linkHeight = 9,offSet = 63,  height= 462.6-disp*0;

      var position = [offSet, linkHeight+height, linkWidth+offSet, height];

      var linkBox = this.addLink(pageNum, position);

       

      I will run the above code in a loop to produce multiple "Link" boxes. This part is pretty straight forward but, I would like to add one more line to this code that will assign the "Link" box to open a specific PDF on my hard drive.

       

      So far I have found a few things online that are supposed to work.....but they don't. Here is the next line of code that I am using to try and achieve my desire end result.

       

      leftLink.setAction("app.openDoc('/C/Users/Username/Desktop/myDoc1.pdf');");

       

      After running all 5 lines of code and clinking on the generated "Link" box, this is what is displayed in Acrobat Pro (8.1).

       

       

      Now the link will work properly if clicked on. It will open the desired document. But, it will only work if using Acrobat Pro. I need this to work on the Acrobat DC as well.

       

      What I would like the Java script to do is, add an action to "Open a file", this will need to be done twice (each link will open 2 different files).

      Below is a picture of what the end result would look like if the script was written properly.

       

       

      I appreciate any feedback and look forward to seeing if anyone else has found a solution to this problem. Thank you for your time.