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

addLink is not defined error

New Here ,
Aug 16, 2018 Aug 16, 2018

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

TOPICS
Acrobat SDK and JavaScript
3.0K
Translate
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 ,
Aug 20, 2018 Aug 20, 2018

Using the link I get following error:

ReferenceError: newWord is not defined

1:Link:Mouse Up

Where did you set this variable?

Translate
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 ,
Aug 20, 2018 Aug 20, 2018

Please have a look at the script which I'm using Dropbox - script.js

Translate
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 ,
Aug 20, 2018 Aug 20, 2018

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.

Translate
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 ,
Aug 20, 2018 Aug 20, 2018

I have changed the link alone.Sorry for the change!!

The link is confidential

Translate
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 ,
Aug 20, 2018 Aug 20, 2018

Why did you include a variable in it, and where is that variable defined?

Translate
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 ,
Aug 20, 2018 Aug 20, 2018

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

Translate
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 ,
Aug 20, 2018 Aug 20, 2018

SorryIt is defined here,

newWord = ckWord.concat(nextWord);

should I add 'var' before it? Is that a mistake?

Translate
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 ,
Aug 20, 2018 Aug 20, 2018

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.

Translate
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 ,
Aug 20, 2018 Aug 20, 2018

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

Translate
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 ,
Aug 20, 2018 Aug 20, 2018

We did, but you're not making it easier because you're not providing us with the correct code you're using.

Translate
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 ,
Aug 20, 2018 Aug 20, 2018

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?

Translate
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 ,
Aug 20, 2018 Aug 20, 2018

Use this:

newWord="hai";

l.setAction("app.launchURL('http://www.google.com?q="+newWord+"');");

Translate
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 ,
Aug 20, 2018 Aug 20, 2018

Thanks much..It worked!!!

Is there any method to enable hyperlink feature through javascript for adobe reader?

Translate
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 ,
Aug 20, 2018 Aug 20, 2018
LATEST

No.

Translate
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 ,
Aug 20, 2018 Aug 20, 2018

You will get the error also in Adobe Acrobat. Restart Adobe Acrobat, open the file with, and try the link.

Translate
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 ,
Aug 20, 2018 Aug 20, 2018

Can you share a sample file?

Translate
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 ,
Aug 16, 2018 Aug 16, 2018

[Question moved to the JavaScript forum]

Translate
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