Copy link to clipboard
Copied
I'm creating a feature in acrobat reader to navigate to a web page when certain words are clicked.
I'm using the 'addLink' function to do it by referring the book 'Developing Acrobat Applications using Javascript' but I'm getting the error 'addLink is not defined'
Please help with possible solutions
Thanks in advance
Copy link to clipboard
Copied
Using the link I get following error:
ReferenceError: newWord is not defined
1:Link:Mouse Up
Where did you set this variable?
Copy link to clipboard
Copied
Please have a look at the script which I'm using Dropbox - script.js
Copy link to clipboard
Copied
This is not the script you used on the sample file you shared, because the link is not the same.
Post your actual code, please.
Copy link to clipboard
Copied
I have changed the link alone.Sorry for the change!!
The link is confidential
Copy link to clipboard
Copied
Why did you include a variable in it, and where is that variable defined?
Copy link to clipboard
Copied
The 'newWord' is the variable and it is defined in the line
var nextWord = this.getPageNthWord(p, i+1, false);
The variable was included in the url to navigate to the web page based on the value of the variable
Copy link to clipboard
Copied
SorryIt is defined here,
newWord = ckWord.concat(nextWord);
should I add 'var' before it? Is that a mistake?
Copy link to clipboard
Copied
Yes, that's better, but it's not the issue.
You need to include the actual value of that variable when you set the link, but include a reference to it.
If you post your actual code (just the line that sets the link's action is enough) we could help you change it.
Copy link to clipboard
Copied
I don't know what is wrong suddenly.I was not getting that error.Let me try that from my side
The actual issue for me is that 'addLink' is not working at the reader side even if the pdf is saved by adding links in the acrobat
Please give your help for this issue
Copy link to clipboard
Copied
We did, but you're not making it easier because you're not providing us with the correct code you're using.
Copy link to clipboard
Copied
Consider this as my requirement like appending a word to the the URL
newWord="hai";
l.setAction("app.launchURL('http://www.google.com?q='+newWord);");
I'm getting error for this.How to resolve this?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thanks much..It worked!!!
Is there any method to enable hyperlink feature through javascript for adobe reader?
Copy link to clipboard
Copied
No.
Copy link to clipboard
Copied
You will get the error also in Adobe Acrobat. Restart Adobe Acrobat, open the file with, and try the link.
Copy link to clipboard
Copied
Can you share a sample file?
Copy link to clipboard
Copied
[Question moved to the JavaScript forum]