Skip to main content
rakeshk21205956
Inspiring
April 12, 2017
Question

I want to add number of pages in a pdf form depending upon the value in the text field...

  • April 12, 2017
  • 1 reply
  • 1039 views

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

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
April 12, 2017

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

try67
Community Expert
Community Expert
April 12, 2017

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

rakeshk21205956
Inspiring
April 12, 2017

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.


can you plz provide the script.... or any link where i can get this script...according to my needs.