Adding links to PDF with JavaScript
Copy link to clipboard
Copied
Hello, I'm trying to add a hypertext link to my PDF using javascript (or applescript), but it's not adding quite the way I want.
When I create the link rectangle, I'm applying an action with the setAction command
Example :
myLink.setAction(\"this.getURL('http://adobe.com')\");
Once the link has been created, upon investigation of the link it will be created as a "Run a javascript" action in the PDF instead of an "Open a web link" action. Is there a different option instead of "getURL" that I should be using to create the link as an "Open a web link" action?
Thanks in advance for any assistance!
Copy link to clipboard
Copied
There are many types of action in PDF. But you can only add a JavaScript action with this API. The JavaScript you are adding is this.getURL('http://adobe.com'). The effect is that it makes a JavaScript which acts as a web link. You cannot make links of any other kind programmatically.
Copy link to clipboard
Copied
Use this:
myLink.setAction("app.launchURL('http://adobe.com');");
Copy link to clipboard
Copied
The "Hyperlink Maker" which is part of the free abracadabraTools can help you:
https://www.abracadabrapdf.net/utilitaires/utilities-in-english/abracadabratools_en/
Acrobate du PDF, InDesigner et Photoshoptographe

