Skip to main content
Known Participant
May 9, 2018
Question

Give a number page to a template

  • May 9, 2018
  • 5 replies
  • 1723 views

Hi everyone !

i'am usign acrobat DC (15) on windows.

I have pages spawning when a button is clicked. I would like to display dynamically the page number of a spawned page. In other words, my document has initailly 1 page ( with 8 templates), when the user decides to spawn a page or more, i have a little "blank space" where i would like to display page number.

i am a newbie !!!

thx for evertyhing 😃

This topic has been closed for replies.

5 replies

JR Boulay
Community Expert
Community Expert
May 14, 2018

I use a trick: I never spawn/add one page somewhere in a document: first I delete all pages and I re-spawn all pages in their final order, starting by the end. This is usefull for small documents, less than 50 pages, since you never have to manage a relative pages order.

the calculateNow() method doesn't trigger fast enough

Add this script at the beginning of the script:

this.calculate = false;

And add this one at the end :

this.calculate = true;

this.calculateNow();

Acrobate du PDF, InDesigner et Photoshopographe
JR Boulay
Community Expert
Community Expert
May 11, 2018

Bonjour.

Une réponse claire et en français se trouve ici : https://abracadabrapdf.net/forum/index.php/topic,3224.msg18951.html#msg18951

Enjoy.

Acrobate du PDF, InDesigner et Photoshopographe
Known Participant
May 11, 2018

Merci !

Mais cela ne marche que pour les pages ayant été DUPLIQUEES et SPAWNED ( simultanément) =(

Inspiring
May 11, 2018

What do you mean by "take into consideration whatever order the pages will be spawed"?  Doesn't spawned pages append to the end of the document?  Therefore, their order in the document is the same as the order they were spawned?

Inspiring
May 9, 2018

Also, I think the switch statement is not necessary.  You could use those abreviations directly as export values right from your dropdown menu.

Known Participant
May 9, 2018

thx !!!! for the tips and advice ... =)

however, i ve putted this code in a the main page and 2 templates ( just to try if it works ) ... some problems appear :

The " this.pageNum" does'nt seem to work, because it's blocked at 0, and instead of incrementing the total number of page, it decreases.

For example, page 1 : 0/1,

after spawning a page : page template A : 0/1 AND page 1 : 0/2

Known Participant
May 9, 2018

actually, only the last decreases of "1"

Inspiring
May 9, 2018

Add a field at the bottom of each pages and each template.

Put this in the calulate script:

event.value = "Page "+this.pageNum+" / "+this.numPages

by the way, you do not have to put your alert inside a variable to trigger it ;o)

//pop up for the user

var message = app.alert("Vous avez sélectionné une qualification d'instructeur \n\n"+"La page concernant la qualification vient d'apparaître à la fin du document",1)

Bernd Alheit
Community Expert
Community Expert
May 9, 2018

Add text fields for the page numbers to the templates.

Known Participant
May 9, 2018

thx !

but the pages could be spawned in any order, so inside the first page, the number of page should change, et depending on which pages will be spawned, the number should also appear in the pages spawned.

For example,

First page : 1/1

then,template page A and template page B are spawned ( the order could change)

so

the firest page 1/3

and template page A : page 2/3

and template page B : page 3/3

Bernd Alheit
Community Expert
Community Expert
May 9, 2018

After spawning the page you must set the value of the text field.