Skip to main content
Fiddling Orion
Inspiring
December 20, 2022
Answered

Need to update page numbers in footer after spawning hidden pages..

  • December 20, 2022
  • 1 reply
  • 2754 views

Hello, and need help...

 

I have a footer showing the page numbers (#/#) in an application I am creating. Easy peesy, but then I involve spawned hidden pages that can be respawned for more. But those pages with the footers don't update. The total number retains the original page count, and the sequence of pages do not adjust. 

 

Is there some way, perhaps a Javascript action, where I can get the pages on the footer to update?

This topic has been closed for replies.
Correct answer Thom Parker

That's a lot better, but there is a misunderstanding from the original answer. i thought JR meant to put this into the edit footer feature where I put the page numbers, where there is no opportunity to place any fields. Your solution seems to infer that to place a field on each page and then do a calculation script, which is a good idea. But unfortunately, I am running out of time and can't focus on learning through a ton of things I know, and don't need to know (right now), for this to get to the solution, so I give up. Thanks anyway..


The "edit footer" feature adds static content to the PDF pages. The footer text cannot be updated dynamically with a script. The only way to add dynamic page numbers to spawned Page Template is with a text field on the templates. 

 

Just add a calculation script to it using the code provided by JR. 

 

 

 

 

1 reply

JR Boulay
Community Expert
Community Expert
December 21, 2022

Place this as a calculation script in the page number fields:

 

event.target.value = this.pageNum+1;

or

event.target.value = this.pageNum+1 + " / " + this.numPages;

 

==> You must add "calculateNow()" at the end of the spawning script to update these fields.

Acrobate du PDF, InDesigner et Photoshopographe
Fiddling Orion
Inspiring
December 21, 2022

Thanks, though I can't quite figure how to put script in the page number fields. I tried..  I am using Adobe Acrobat Pro, latest version. Help?

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
December 21, 2022

That's a lot better, but there is a misunderstanding from the original answer. i thought JR meant to put this into the edit footer feature where I put the page numbers, where there is no opportunity to place any fields. Your solution seems to infer that to place a field on each page and then do a calculation script, which is a good idea. But unfortunately, I am running out of time and can't focus on learning through a ton of things I know, and don't need to know (right now), for this to get to the solution, so I give up. Thanks anyway..


The "edit footer" feature adds static content to the PDF pages. The footer text cannot be updated dynamically with a script. The only way to add dynamic page numbers to spawned Page Template is with a text field on the templates. 

 

Just add a calculation script to it using the code provided by JR. 

 

 

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often