Set XFA fields in Acrobat Portfolio



Hi there

I need some help regarding a Acrobat Portfolio which includes some XFA pdf forms and the people from the Acrobat Forum told me to post it hiere... 🙂

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;


    // loop over pages and set the fields

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


        dataObject = this.getDataObject(attachments[a].name);".")).toLowerCase();

        if (fileType == ".pdf")


            try {

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

                if(doc.xfa) {

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

                        doc.xfa.resolveNode("xfa.form..Textfield_3").rawValue = "newValue_Textfield_3";

                        app.alert("set field Textfield_3: " + doc.xfa.resolveNode("xfa.form..Textfield_3").rawValue);




                //    doc.closeDoc(false); (won't work for reader)

            } catch(e) {

                app.alert("Fehler: " + + " -> " + e.message + " -> " + e.extMessage + " -> on line " + e.lineNumber);





    app.alert("Finished updating XFA PDFs");

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

I also figured that the operation "doc.closeDoc(false)" does not work with acrobat reader for some reason. So it could be that because I don't close the docs there is some problem with several open docs...

Thanks for any help on this!

Accepted Solutions (0)

Answers (0)