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

addLink is not defined error

New Here ,
Aug 16, 2018 Aug 16, 2018

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

TOPICS
Acrobat SDK and JavaScript

Views

1.9K

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

Copy link to clipboard

Copied

Use Adobe Acrobat, not Acrobat Reader.

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

Copy link to clipboard

Copied

I'm using adobe acrobat pro dc..even then I'm getting the error

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

Copy link to clipboard

Copied

Post the Code. May be we can help you.

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

Copy link to clipboard

Copied

if ( typeof sdkMenuItem == "undefined")

var sdkMenuItem = false;

if (!sdkMenuItem) {

sdkMenuItem = true;

app.addSubMenu( {

cName:"ACROSDK:JSSubMenu",

cUser: "Acrobat SDK JavaScript",

cParent: "Edit",

nPos: 0

});

}

// add a menu item  to extract text.

app.addMenuItem(  { 

cName: "ACROSDK:AddLinks",  

cUser: "Add links to retrieve partNo info ...",  

cParent: "ACROSDK:JSSubMenu",

cEnable: "event.rc = (event.target != null);", 

cExec: "AddLinks();"

}); 

function AddLinks() 

try  {

var p=this.pageNum;

var numWords = this.getPageNumWords(p);

for (var i=0; i<numWords; i++)

{

var ckWord = this.getPageNthWord(p, i, true);

if ( ckWord == "Acrobat")

{

var q = this.getPageNthWordQuads(p, i);

// convert quads in Default User Space to Rotated

// User Space used by Links.

m = (new Matrix2D).fromRotated(this,p);

mInv = m.invert()

r = mInv.transform(q)

r=r.toString()

r = r.split(",");

l = addLink(p, [r[4], r[5], r[2], r[3]]);

l.borderColor = color.red

l.borderWidth = 1

l.setAction("this.getURL('http://www.adobe.com/products/acrobat', false);");

}

}

} catch (e)  { 

app.alert(e)

}; 

}

I need to somewhat tweak the logic based on the my requirement but my intention is same as in the code

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

Copy link to clipboard

Copied

Try:

this.addLink( ...);

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

Copy link to clipboard

Copied

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

Copy link to clipboard

Copied

Why are you using getURL? That attempts to convert the web-page into a PDF, which won't work in Reader, for example.

If you just want to display that web-page then use app.launchURL("http://..."), instead.

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

Copy link to clipboard

Copied

Thanks! It worked

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

Copy link to clipboard

Copied

The code works fine for me, although I agree that adding "this." before addLink is a good idea.

I would also drop the try-catch clause, so you could see the full error message in the console.

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 ,
Aug 19, 2018 Aug 19, 2018

Copy link to clipboard

Copied

Is there any alternative for 'addLink' function to use in adobe reader?

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 ,
Aug 19, 2018 Aug 19, 2018

Copy link to clipboard

Copied

Acrobat Reader can't add links.

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 ,
Aug 19, 2018 Aug 19, 2018

Copy link to clipboard

Copied

I have created a feature in acrobat dc pro to navigate to a web page using addLink function in javascript.I want to push this feature in adobe reader but when it is executing,I'm getting 'NotAllowedError:Security settings prevent access to this property or method'

What are the steps for pushing the feature to 'Reader' which was developed in 'Acrobat pro'

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

Copy link to clipboard

Copied

None. It can't be achieved in Reader. Nor do I see why you would need to.

Create the file in Acrobat, add the links to it, and then distribute it to the users. The links you created will work in Reader. They don't need to be added there.

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

Copy link to clipboard

Copied

I enabled the feature in acrobat and saved the document.When I opened the saved document using reader,the link is not redirecting to the required page.

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

Copy link to clipboard

Copied

What kind of link?

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

Copy link to clipboard

Copied

The hyperlink created using 'addLink' function in javascript

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

Copy link to clipboard

Copied

As I told you earlier, the getURL method won't work in Reader.

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

Copy link to clipboard

Copied

I'm not using getURL method,launchURL method is used for navigation

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

Copy link to clipboard

Copied

OK, so what happens when you click the link, exactly?

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

Copy link to clipboard

Copied

The links do exist but no action is getting performed

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

Copy link to clipboard

Copied

Can you share a sample page with some links (via Dropbox, Google Drive, Adobe Send & Track, etc.)?

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

Copy link to clipboard

Copied

I have shared a sample doc which you access through the dropbox 840190-0000revA-SHT1 (2)

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

Copy link to clipboard

Copied

It is not possible to access this link.

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

Copy link to clipboard

Copied

Please use this link Dropbox - sampledoc.pdf

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