Is there a direct way for a javascript to setup a link that is equivalent to the acrobat link type you get when you add a link of the type “Go to a page in another document”?
Tools-Advanced Editing-Link tool, make a box
Check: Go to page view, Next (Create go to view dialog opens)
Open second document and go to page
Click “Create go to view dialog” to set up link
Result is a link, when view by link properties, with an action of
Go to a page in another document
File: C:\My Documents\File2.pdf
Page: 43
Zoom level: Custom
I have a java script in a setAction of a link that I think does the job:
But is there a more direct way that actual sets up a “a link of the type Go to a page in another document” so if it's "advanced edited" its the same as the manual set links?
I would like to setup a set of pdf documents, on the hard disk of a PC or Mac, that can be open with acrobat pro running on the same computer and have the link jump to, and open in a new window, in acrobat pro, to a given page of a second document in the set.
John
Code example in more detail:
/* Insert document level JavaScript to set disclosed = true.
This will run when the document is opened.*/
// Search through the document for the word “Acrobat” and create a link around that word.
for (var p = 0; p < this.numPages; p++)
{
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.blue
l.borderWidth = 1
//l.setAction("this.getURL('http://www.adobe.com/');");
l.setAction("var otherDoc = app.openDoc('../Folder2/File2.pdf', this);otherDoc.pageNum = 3 - 1;");
}
}
}
Current Systems in use to create documents with links and view them:
Windows XP SP3
Word 2003 SP3
Acrobat 9 pro version 9.4.4
Or just to view them:
Mac OS 10 Lion version 10.7.4
Acrobat 9 pro version 9.5.1
(note I have limited understanding of Mac’s)
If you use buttons instead, it is possible to script adding the actions that you want. It involves creating a properly constructed FDF, saving it, and then importing it into the document. Buttons can be made to appear just like links. For more information, see: http://www.planetpdf.com/developer/article.asp?ContentID=6338
North America
Europe, Middle East and Africa
Asia Pacific