Copy link to clipboard
Copied
Sir,
I am making a PDF form in Adobe acrobat Pro in which the requirement is to add any number of pages which use inputs in the text field.
Like if the user put 4 then 4 pages should be added , if they put 40 the 40 pages should be added.... i know to add the pages by the spawning method.....
i.e. var a = this.getTemplate("Template Name");
a.spawn();
but i am not able to figure out how to add as many pages as specified by the users......
Also second query....
I would like the first page to be number page 1 of 1, then when the user needs a second page it would numbered as Page 1 of 2 and Page 2 of 2 and so on...
Is it possible.
If yes, then plz help.
Thank you
Copy link to clipboard
Copied
It's possible, but you need to think carefully about how it is going to work.
Let's say the user enters "4" into this text field (?), and four pages are spawned. Then they fill in those pages and remember they actually need 6, not 4. So they go back to the text field and change the value. What should happen then? Delete the existing pages (with all of the user's input) and create 6 new ones? Add only two new pages? Reject/ignore this change? etc. This is a complex situation...
Copy link to clipboard
Copied
... And what if they change the number from 4 to 2? Should it delete all 4 pages and add new ones? Delete just the last 2? The first 2? etc.
Copy link to clipboard
Copied
you are right the above situation may arise... but in my case it is little easier as the first page will contain all the data to be inputted in the spawned pages ........ if there is name field in the first page... the spawned page will have the same name fields..... so if user changes his mind from needing 4 pages to 2 then the rest of the pages may be deleted.......... the same case with with addition if they change ffrom 4 to 6 then simply add 2 more pages ... as the field will be populated from the master page (users don't have to input any value in my spawned pages)
Copy link to clipboard
Copied
In that case you need to calculate how many pages to add/delete based on the user's input, and then call the spawn method (or the deletePages method) X number of times to do that.
You need to read the documentation of the spawn method as it explains how to spawn multiple pages efficiently, and how to set it to rename (or not to rename) the fields in the template page.
As for the page numbers: After adding/removing the pages you can use a separate command to add form fields that will hold those page numbers.
Copy link to clipboard
Copied
can you plz provide the script.... or any link where i can get this script...according to my needs.
Copy link to clipboard
Copied
I provided a description of how it should work. It's up to you to implement it.
If you want me to write the code for you contact me privately (try6767 at gmail.com) and we could discuss it further, including the price.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now