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

hoe to retrieve a page number in PDF

piyush
Registered: Jun 26 2008
Posts: 4

Dear friends..
I have 1 button and a text box in PDF, on button press i want to swith my page according to text box value. so can u please help me to write code regarding this..

if u entered 4 on text box and press button. it ll jump on the page this type of functionality i want ....

so please send me reply as soon as possible.......

Thanks....

My Product Information:
Acrobat Pro 8.1.2, Windows
piyush
Registered: Jun 26 2008
Posts: 4
Two this more i want to ask ....
1) How we can trace any value while we are writing code under PDF using JavaScript.
2) And how to retrieve a text value .
jbfreels
Registered: Feb 19 2008
Posts: 63
This will change the page...
this.pageNum=this.getField(YOURBOXNAME).value-1;
I have NO IDEA what you mean by item #1, but to get the value of a form item you use getField. Please refer to the Adobe JavaScript API Reference for more information.

-jb
gkaiseril
Expert
Registered: Feb 23 2006
Posts: 4308
Page numbers in JavaScript start at zero. They also are the just the sequential pages and not the renumbered pages. So if you have a 10 page document the frist page is zero and the last page is 9. To display the page numer in a message you add 1 and to navigate to a page from user input you subtract one. Acrobat forms use user selected form field names. So if you had a field formatted for numeric entry with a validation that the lowest number could not go below 1 and your field was name "SkipToPage", the "Mouse Up' action for the button could be:

// set the displayed page to the value of the "SkipToPage" value less 1
this.pageNum = this.getField("SkipToPage").value - 1;

George Kaiser