Solved

how do I assign a destination page in adobe acrobat using javascript with a form field button?

Posted on 2004-03-24
9
435 Views
Last Modified: 2007-12-19
I want to create a form field rather than a link in adobe acrobat so I can duplicate it across the document.  The function of the form field  is to take me to a certain page of that document.  The link tool cannot be duplicated and I want to know what the javascript (if any) is for 'go to page 3' so I can use the javascript function in the 'actions' section of a form field.  Hope I have explained my self well enough.

Many thanks
Graeme
0
Comment
Question by:GRAEMEBLAND12
  • 5
  • 4
9 Comments
 
LVL 3

Accepted Solution

by:
btech1 earned 500 total points
ID: 10668854
I am not too sure what you need to do, could you explain more?

Btw, this example goes to the first page of the document.

    this.pageNum=0;
0
 

Author Comment

by:GRAEMEBLAND12
ID: 10668991
Thanks for responding.
I have a 22 page pdf document that users will navigate through using buttons on the top of the page.  One of these buttons will take them to the contents page of the document.  Each page will have a link to the contents page which is on page 3.  Previously I have used the link tool in acrobat and created individual links on each page to navigate the user to the contents page.  I want to know how to use the form field tool to create a link to a page in a document.  The form field is the only button I know of that can be duplicated on each page automatically. Javascript is an option for the acrtion you assign to the form field button.  I have tried 'this.pageNum=3' but this seems to come up with the wrong page.

0
 

Author Comment

by:GRAEMEBLAND12
ID: 10669022
btech1

I have just tried 'this.pageNum=+2' and it works thank you for pointing me in the right direction!
0
 
LVL 3

Expert Comment

by:btech1
ID: 10669273
Thanks for the grade A.

Btw, you may already know this this.pageNum=++ advance to next page
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:GRAEMEBLAND12
ID: 10669276
Spoke to soon.  It doesn't work. That code only advances you two pages back or something.

Can you help?
0
 

Author Comment

by:GRAEMEBLAND12
ID: 10669287
My mistake it does work. I wish I knew what I was doing.
0
 
LVL 3

Expert Comment

by:btech1
ID: 10669310
No problem. Let me know if need help on this.
0
 

Author Comment

by:GRAEMEBLAND12
ID: 10669320
this.pageNum=2 has got me to the contents page which was on page two not three.  Looks like it is fine now.  Thanks again for your help that has been stumped me for about  year and a half.
0
 
LVL 3

Expert Comment

by:btech1
ID: 10669388
Fyi, here is an example to create simple navigational links in the lower left and right corners of each page of the current document. The link in lower left corner goes to the previous page; the one in the lower right corner goes to the next page.

var linkWidth = 36, linkHeight = 18;
for ( var i=0; i < this.numPages; i++)
{
      var cropBox = this.getPageBox("Crop", i);
      var linkRect1 = [0,linkHeight,linkWidth,0];
      var offsetLink = cropBox[2] - cropBox[0] - linkWidth;
      var linkRect2 = [offsetLink,linkHeight,linkWidth + offsetLink,0]
      var lhLink = this.addLink(i, linkRect1);
      var rhLink = this.addLink(i, linkRect2);
      var nextPage = (i + 1) % this.numPages;
      var prevPage = (i - 1) % this.numPages;
      var prevPage = (prevPage>=0) ? prevPage : -prevPage;
      lhLink.setAction( "this.pageNum = " + prevPage);
      lhLink.borderColor = color.red;
      lhLink.borderWidth = 1;
      rhLink.setAction( "this.pageNum = " + nextPage);
      rhLink.borderColor = color.red;
      rhLink.borderWidth = 1;
}

Later!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
html form to write data to csv 24 97
Check if Object property exists? 3 19
Regex in JavaScript to validate US phone number with hyphens 3 28
Capture logon name 13 48
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now