• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Need help with Java script in Acrobat Pro (8.1)

New Here ,
Mar 09, 2018 Mar 09, 2018

Copy link to clipboard

Copied

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.

TOPICS
General troubleshooting

Views

297

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 09, 2018 Mar 09, 2018

Copy link to clipboard

Copied

A script can only create an action that executes another script. If you want to use a different kind of action you have to use a plugin or a stand-alone application, and those are much more complicated to develop.

I've create a tool that converts JS actions of certain types to their "real" counterparts (such as going to a specific page or opening a URL). It shouldn't be too difficult to add the option to convert app.openDoc() commands to an "Open a file" action.

The tool is available here: Custom-made Adobe Scripts: Convert JavaScript Links To Real Links

Feel free to contact me privately (try6767 at gmail.com) if you're interested in it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 09, 2018 Mar 09, 2018

Copy link to clipboard

Copied

Thanks for the input. I could not get the demo program to work properly (From what you said I don't think it was designed to open a file location). Either way I cannot pay for the full version. I would like to try and find a free solution to this problem. If anyone else thinks that this can be done without using an outside program please let me know. Or if it can be done with a free outside program that would be fine as well.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 09, 2018 Mar 09, 2018

Copy link to clipboard

Copied

LATEST

As I wrote, the current tool can't do it, but I might add it as a new

feature.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines