Acrobat DC PRO - add pages - refresh page numbering
Hi there,
I have found many replies to this kind of issue but none helped me so far. So here is what i work with and what i did so far.
I have a form of 1 page (intropage). To this 1st page can be added 3 different templates.
- interior checkup
-exterior checkup
- final page (for signatures, annotations etc)
I have added 3 buttons on each template with javascripts to "add" the page model, when needed.
The javascript looks like this:
this.insertPages({nPage:this.numPages-1, cPath:"MODELNAME.pdf"});
The "Modelname" is for showcase here, I use the specific file name of the int/ext/final page.
Depending of the situation, I need my first page and, for this example, 4 interior check templates and 3 exterior check templates - and of ourse the final side for signing.
Actually my page numbering is scripted in a text field (custom calculation) as follows :
var pnum = this.pageNum+1;
var numpag = this.numPages
event.value = pnum + " / " + numpag;
A Document JS is added:
this.calculateNow();
A checkbox is added to each template to "trigger" the calculation, so at the end of editing, i check it,
the field value is changed ==> this makes the calculation script "run" and "refreshes the page numbering (at least, thats how i understood it in the forums.)
My guess : the field names for page calculation are not unique. As I sometimes need 5x interior template and let's say additionnally 8x the exterior template - I have 13 identical fieldnames on multiple pages and the scripts start bugging.
What happens ? When i click the checkbox on page 5, if gives me page 5/5 (wich is correct) but every page will now have this page numbering.
I'm a bloody user who builds a form with some extra features to add pages when needed. So far, this was my idea to get to the right solution. Maybe there is a completely other way to do so ? Or somebody has the script-solution i need because of identical fieldnames ?
I already present you my apologies for eventual major logical bugs in this post. And thank you for your patience for ready my post.
Many thanks for your help & time
Tom
