1 Reply Latest reply on Jun 3, 2015 3:05 PM by George_Johnson

    Spawn template pages... having trouble


      Hello all,


      I'm trying to create a document that allows users to add additional pages as needed.  It's a 2-page document with an optional page(s) that goes in the middle (I made the middle page into the hidden template).  I'm not a programmer and don't have any knowledge of javascript, so I'm having a hard time with this.  I'll try to explain this as best as I can:


      Page 1 is the intro page that users will fill out initially.  The optional middle page is an extension of some of the fields found on page 1 - it basically adds a page of new rows.  This page contains calculations, which don't seem to duplicate.  The last page is a signature page with different information on it. I made a button "Click to Add More Fields" on the first page and I am using this script to generate new pages:


      var a = this.getTemplate("Add More Fields");a.spawn();


      It seems like it works to generate the pages, but I'm having trouble with a few things.


      1. The calculations don't copy over to the new pages, it just auto populates whatever I put on the first added page and when I change the numbers, the calculation is broken so the numbers don't add up.  Is it even possible to use the template feature with calculations?

      2. The new pages just copy all the info from the first spawned one - I want the user to start out on a fresh page each time rather than having to overwrite the info that auto populated.

      3. I have some day and date code fields that I would like to be copies from the very first page so the user doesn't have to enter them on each new page.

      4. New pages spawn at the end of the document... I would like them to spawn before the last (signature) page.

      5. Is there a way to add page numbering that automatically adjusts based on the number of pages a user spawns?


      Sorry for all the questions.  If anyone has any input I would be grateful... I fear I'm a little out of my depth here, I've been reading for hours and it's not making much sense.

        • 1. Re: Spawn template pages... having trouble
          George_Johnson MVP & Adobe Community Professional

          There are a number of things that you have to change. First, when spawning a new page, you have the option to rename the fields so they aren't the same as the template.


          For the fields that you want to be copies, you can place them on a entirely separate hidden template all by themselves. After spawning the first template to create the new page, spawn this second on on top of the newly created page and don't rename the fields.


          The calculations should be done using JavaScript, as opposed to one of the other built-in methods, so that they can be performed properly. This can get a bit complicated and depends on how the calculations are set up.


          When you spawn a template, you can specify where in the document you want the new page to appear or which page you want it to overlay. More information is in the Acrobat JavaScript documentation.


          Adding page numbering is possible but the script can be complicated depending on how the form is set up, so it's hard to give specific help.


          Have you read through this tutorial? Planet PDF - A Lesson in Templates for Adobe Acrobat