Skip to main content
Inspiring
February 22, 2024
Answered

Automatic update of page numbering after pages are spawned

  • February 22, 2024
  • 2 replies
  • 1892 views

Hi there,

 

I have read a thread on how to do this but on my test version the same number is populating the page number text field on all pages. 

 

event.target.value = this.pageNum+1 + " / " + this.numPages;  is in the custom calculation for the page number text field

and on the spawn page button on page 2 calculateNow() is on the last piece of javascript. 

 

Any ideas why this won't be working?

 

Many thanks in advance,

 

Steve

This topic has been closed for replies.
Correct answer try67

It will work if you renamed the fields when spawning the page.

2 replies

JR Boulay
Community Expert
Community Expert
February 22, 2024

This is because on a spawned page the page number is not a Number, it's an array (since it's a duplicated page) where the spawned page number is the first digit.

 

You must use this script:

 

 

var aNumPag = event.target.page;
event.value = ((aNumPag[aNumPag.length-1]) + 1) + " \/ " + (this.numPages);

 

 

 

Acrobate du PDF, InDesigner et Photoshopographe
try67
Community Expert
Community Expert
February 22, 2024

Replace this.pageNum+1 with event.target.page+1 .

Inspiring
February 22, 2024

Hi Try,

Many thanks for your help. 

 

that has worked for the static pages but the spawned ones are showing -1,3 of 7 etc..

 

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
February 22, 2024

It will work if you renamed the fields when spawning the page.