• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Explorer ,
Dec 20, 2022 Dec 20, 2022

Copy link to clipboard

Copied

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?

TOPICS
Create PDFs , JavaScript , PDF forms

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , Dec 21, 2022 Dec 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.

Votes

Translate

Translate
Community Expert , Dec 21, 2022 Dec 21, 2022

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. 

 

 

 

 

Votes

Translate

Translate
Community Expert ,
Dec 21, 2022 Dec 21, 2022

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 21, 2022 Dec 21, 2022

Copy link to clipboard

Copied

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 21, 2022 Dec 21, 2022

Copy link to clipboard

Copied

Read this, and watch the free videos:

https://www.pdfscripting.com/public/PDF-Form-Scripting.cfm

 

 

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 21, 2022 Dec 21, 2022

Copy link to clipboard

Copied

I know a lot of that stuff already and don't have time to watch a ton of everything to get to the simple solution I need. 

My assignment on this is due very soon and the page numbers were merely an extra touch.

And, your link requires me to create a member account and PAID subscription for anything that is linked (and videos), especially the section where I think the answer lies. Sorry, I am not doing that. 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 21, 2022 Dec 21, 2022

Copy link to clipboard

Copied

All the basic info on the site is free

You'll find the answer you need, i.e., how to enter the field calculation script here:

https://www.pdfscripting.com/public/Editing-Fields-Properties.cfm

and here:

https://www.pdfscripting.com/public/Entering-Calculation-Scripts.cfm

 

 

 

 

 

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 21, 2022 Dec 21, 2022

Copy link to clipboard

Copied

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..

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 21, 2022 Dec 21, 2022

Copy link to clipboard

Copied

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 PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 21, 2022 Dec 21, 2022

Copy link to clipboard

Copied

Thanks,

Unfortuntatly, I figured that too late, as I thought JR meant the page number "fields" in the footer text editing page where I applied the page numbers, which I thought you could somehow.  I just needed the means to put that script and that's it. Didn't think of of putting a text field on the templates itself....which would have been a better workaround. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 22, 2022 Dec 22, 2022

Copy link to clipboard

Copied

LATEST

@JR Boulay Works perfectly, after realizing I just needed to put a field on every page with the script. Thanks also @Thom Parker for clarifying!

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines