2 Replies Latest reply on Mar 2, 2010 8:16 AM by mvjfurnc

    Copying a changing form page to a new PDF

    mvjfurnc Level 1

      I have a one-page Acrobat Form (in a PDF). I have written a Javascript to connect to a database using ADBC and read from the rows of a table in the database. Essentially, the form contains 3 copies of the same set of Form fields, and I fill the field using a script:

       

      function FillForm(row)
      {
        if (placenum == 1)
        {
          sufx = "1"
        }
        else
        {
          sufx = "1_"+placenum;
        }
        this.getField("YearRow"+sufx).value = row.Prt_Year.value;
        this.getField("MonthRow"+sufx).value = row.Rpt_Month.value;
        this.getField("Address of SubjectRow"+sufx).value = row.Address.value;
        this.getField("CityRow"+sufx).value = row.City.value;
        this.getField("Client NameRow"+sufx).value = row.Client.value;
        this.getField("Type of PropertyRow"+sufx).value = row.PType.value;
        this.getField("Site Area SqFt or AcresRow"+sufx).value = row.Site.value;
        this.getField("Primary Improvement GLARow"+sufx).value = row.GLA.value;
        this.getField("Hours ClaimedRow"+sufx).value = row.Hours.value;
      if (placenum == 3)
      {
         CopyPage();
         placenum=1;
         FillFormBlank();
      }
      else
      {
         placenum=placenum+1;
      }
       
      }

      As you can see, every third row, it attempts to copy the page into a output PDF I've opened using:

       

      function CopyPage()
      {
        newDoc.insertPages({nPage: pnum, cPath: this.path});
        pnum = pnum + 1;
      }

       

      In my output PDF, I get exactly the number of pages I expect, but they are all exactly the same, containing just the info from the very first 3 database rows I brought it.

       

      Is there something I'm missing here. After filling in the form fields and copying, it's as if the subsequent form fillings do not take effect. Is there a reset or something which needs to be done?

       

      I have put console.printlns in and can see that it is reading all the rows from the database, and the values it is attempting to place into the Form fields are

      changing with each database row.

       

      Thanks