I have a series of Acrobat forms that have hidden page templates. I would like to automatically number the pages if/when these pages are spawned into the document. The Header/Footer functionality only works with existing pages and does not update when pages are spawned. I am looking to add the Page ? of ? format. Can you help with the Javascript necessary to achieve this? I haven't yet been successful in finding examples of this type of thing on the web. Is it possible?
So, what you need is a form field to display the number. The form field and be dynamically updated from JavaScript at anytime. Now here's the tricky part. You need to select an event on which to do the update. I'm pretty sure the calculate event will work. It should get called when the page is spawned because new fields are being added to the form, but you'll have to do some testing to be sure. Here's the code for setting the page number.
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script