These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Creating "Go to Page" functionality

Spleckxa
Registered: Jan 6 2010
Posts: 32

Hello all,

I was wondering if anybody has a javascript that will allow a person to type in a page number in a form field and have it open a pdf file to that exact page.

Specifically, I am trying to create a self-contained CD that automatically opens up a pdf file listing all the pdf's contained on the CD. After each pdf listing, there will be a form field asking which page number of that pdf the user would like to go to. Once the user types in the page number and hits ENTER, the pdf would open up to the page the user specified.

I've been trying to see if the Run Command parameters or the URL open parameters for pdf's would work, but it looks like this will have to be done via javascript.

Any help would be much appreciated.

Thanks!

David

try67
Expert
Registered: Oct 30 2008
Posts: 2399
You can use the keystroke event or the validate event and then use the new value of the field (make sure the field is formatted as a number) to go to the page, like so (this code is not tested, so it might need some tweaking):
var value = event.value;if (event.willCommit)this.pageNum = Number(value) - 1;

Have a look in the reference files for more information about the event object.

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

Spleckxa
Registered: Jan 6 2010
Posts: 32
Thanks, try67. You gave me a great starting point work off of.