13 Replies Latest reply on Jul 3, 2015 7:11 AM by try67

    Push Values to XFA Attachments in Portfolio

    Lukas Haldemann_586 Level 1

      Hi there!

      I need some help regarding a JavaScript Acrobat Scripting issue.

      I have a PDF Portfolio (created with Acrobat), including 3 interactive PDF forms (XFA-Forms, created with Live Cycle). What I want to do is have a script on document level of the portfolios cover sheet which counts the pages of all attachments and puts the String "Page X from Y" to a XFA form field inside each attachment. This is how the script looks like right now:

       

      if (this.collection)

          {

          var attachments = this.dataObjects;

          var doc = null;

         

          for (var a = 0; a < attachments.length; a++)

              {

              doc = this.getDataObject(attachments[a].name);

              if(doc.xfa) {

                  if(doc.xfa.resolveNode("xfa.form..FUSSNOTE_PAGES")) {

                      doc.xfa.resolveNode("xfa.form..FUSSNOTE_PAGES").rawValue = "Page X of Y";

                  }

              }

              doc.closeDoc();

          }

      }

       

      Now what I see is that something happens and the documents are filled really with content, but in acrobat reader, only the last attachment remains with the pushed field value, the other two attachments remain without the value. How can I assure that the values will be pushed to all documents using acrobat reader (XI)? Are there any alternatives like global variables (but I cannot have a folder or app level script - only document level)..

      Kind Regards, Bill