addLink is not defined error
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
Use Adobe Acrobat, not Acrobat Reader.
Copy link to clipboard
Copied
I'm using adobe acrobat pro dc..even then I'm getting the error
Copy link to clipboard
Copied
Post the Code. May be we can help you.
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
Copy link to clipboard
Copied
Try:
this.addLink( ...);
Copy link to clipboard
Copied
It worked! Thank you..
The bytes are getting downloaded to direct to the URL but now I'm getting the following error,
General Error https://dpm.demdex.net/id?d_visid_ver=2.5.0&d_fieldgroup=MC&d_rtbd=json&d_ver=2&d_verify=1&d_orgid=9...
General Error https://dpm.demdex.net/id?d_visid_ver=2.5.0&d_fieldgroup=AAM&d_rtbd=json&d_ver=2&d_orgid=9E1005A551E...
General Error https://adobe.demdex.net/dest5.html?d_nsid=0#https%3A%2F%2Facrobat.adobe.com%2Fus%2Fen%2Facrobat.htm...
Please comment your views
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.
Copy link to clipboard
Copied
Thanks! It worked
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.
Copy link to clipboard
Copied
Is there any alternative for 'addLink' function to use in adobe reader?
Copy link to clipboard
Copied
Acrobat Reader can't add links.
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'
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.
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.
Copy link to clipboard
Copied
What kind of link?
Copy link to clipboard
Copied
The hyperlink created using 'addLink' function in javascript
Copy link to clipboard
Copied
As I told you earlier, the getURL method won't work in Reader.
Copy link to clipboard
Copied
I'm not using getURL method,launchURL method is used for navigation
Copy link to clipboard
Copied
OK, so what happens when you click the link, exactly?
Copy link to clipboard
Copied
The links do exist but no action is getting performed
Copy link to clipboard
Copied
Can you share a sample page with some links (via Dropbox, Google Drive, Adobe Send & Track, etc.)?
Copy link to clipboard
Copied
I have shared a sample doc which you access through the dropbox 840190-0000revA-SHT1 (2)
Copy link to clipboard
Copied
It is not possible to access this link.
Copy link to clipboard
Copied
Please use this link Dropbox - sampledoc.pdf


-
- 1
- 2