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

Dynamic Page Numbering in Text Field

Steve-o
Registered: Jun 2 2010
Posts: 8

I've been struggling with a problem and I could use some help.

I would like to duplicate a text field on every page of a multipage document that dynamically displays the current page number of the page being viewed. I have been able to do this with a page-level script, but it's impractical to duplicate (and manage) a page-level script across 200 or more pages. I must be missing something really obvious.

Any help would be most appreciated. I'm far from a javascript expert, so any specific coding would also be appreciated.

Also, I'm aware that page numbering can be done through a footer or header, but this particular application is part of a custom navigation bar where footers and headers won't be used.

My Product Information:
Acrobat Pro 9.3.1, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2399
I don't see what's the point of this. Why not simply add a footer with the page number?

Edit: Sorry, I guess I missed the last line.
You can do this by running a script that loops over all the pages and adds a text field to each of them with the page's number, if you want.

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

Steve-o
Registered: Jun 2 2010
Posts: 8
As I unsuccessfully tried to explain, there are PDF applications where page numbers in footers or headers aren't ideal.

In any event, I think I may have worked it out myself. This code goes with a text field "Page Number" duplicated arcoss the document:

var numpages = this.numPages;
for (var i=0; i < numpages; i++)
this.setPageAction(i, "Open", "this.getField('Page Number').value = this.pageNum + 1");