Solved

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

Posted on 2004-03-24
9
434 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks for the grade A.

Btw, you may already know this this.pageNum=++ advance to next page
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:GRAEMEBLAND12
Comment Utility
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
Comment Utility
My mistake it does work. I wish I knew what I was doing.
0
 
LVL 3

Expert Comment

by:btech1
Comment Utility
No problem. Let me know if need help on this.
0
 

Author Comment

by:GRAEMEBLAND12
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

771 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

12 Experts available now in Live!

Get 1:1 Help Now