?
Solved

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

Posted on 2004-03-24
9
Medium Priority
?
443 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 3

Accepted Solution

by:
btech1 earned 2000 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 

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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…
Suggested Courses

752 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