5 Replies Latest reply on Jun 16, 2011 6:29 AM by dhoult


    csb102155 Level 1

      Hi all, I have a 4 page form and the second page needs to spawn if needed by the user.  Here is the script that I used.


      var a = this.getTemplate("newPage")
      a.spawn ({
      this.pageNum = this.numPages-1;


      What I need to know is how to make it so that the form spawns AFTER the second page, and not at the end of the four pages.

      Can anyone help?




        • 1. Re: Spawning
          gkaiseril MVP & Adobe Community Professional

          I am not familiar with the Acrobat JavaScript "this.num3Pages" property?


          Can you explain what this is or does?


          The 'nPage' parameter value is described as:


          (optional) The 0-based index of the page number after which or on which the new page will be created, depending on the value of bOverlay. The default is 0.


          So if you want the template to be inserted after you physical page 2 or zero based page 1, you use a value of 1 for this parameter.


          Then to goto that page, you need to know the number of pages after the page has been inserted. You started with 4 physical pages and now have 5 physical pages and the physical inserted page is 2 below the total number of pages or 3 and when adjusted for the zero based page number becomes 2. or if more pages are inserted the total number of pages less 3.


          this.pageNum = this.numPages - 3;

          • 2. Re: Spawning
            George_Johnson MVP & Adobe Community Professional

            The documentation for the nPage parameter is a bit confusing. Set it to the number youwant the new page to be. The first page is page 0, so to place it after the second page (1), use 2 for nPage:


            a.spawn ({
                nPage: 2,
            • 3. Re: Spawning
              csb102155 Level 1

              Thanks George - it worked beautifully.

              • 4. Re: Spawning
                csb102155 Level 1
                Hi all:  Have another question regarding the spawning.  The form is a 4 page form, and the second page is set to spawn if the user needs to add additional information.  George gave me a script that will have the page spawn right behind the second page rather than to the end of the 4 page form.  This script works okay for the first spawned page, but if the user selects the spawn again for another page, it spawns it after page 4.  Is there a way that when the user keeps spawning page 2, that it stays right behind page 2 and does not go behind page 4?  Appreciate any assistance on this. 
                Thanks much.
                • 5. Re: Spawning