Skip navigation
Currently Being Moderated

How to setup a link that is of the type “Go to a page in another document”?

Jul 26, 2012 11:55 AM

Tags: #link #setaction #go_to_a_page_in_another_document

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:

 

  1. l.setAction("var otherDoc = app.openDoc('../Folder2/File2.pdf', this);otherDoc.pageNum = 1 - 1;");

 

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.*/

 

  1. this.addScript("setDisclosed", "this.disclosed = true;");

 

// 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)

 
Replies
  • Currently Being Moderated
    Jul 26, 2012 1:15 PM   in reply to HJS2

    Not possible with Javascript.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 27, 2012 3:05 AM   in reply to HJS2

    Yes, there is no other way with Javascript.

     
    |
    Mark as:
  • George Johnson
    11,727 posts
    Aug 11, 2002
    Currently Being Moderated
    Jul 28, 2012 10:25 AM   in reply to HJS2

    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

     
    |
    Mark as:
  • George Johnson
    11,727 posts
    Aug 11, 2002
    Currently Being Moderated
    Jul 28, 2012 10:27 AM   in reply to George Johnson

    After reading that old article I noticed that some of the side details are out of date, but the basic info relating to constructing the actions in an FDF are still accurate.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points