Solved

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

Posted on 2004-03-24
9
436 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
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
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…

809 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