4 Replies Latest reply on May 15, 2015 7:53 AM by gkaiseril

    xfa.host.importData loop JavaScript


      Using JavaScript in Adobe Acrobat, I want to be able to import XML files from a specific folder into a form. I hope to achieve this by opening the PDF form and have the script loop through all the XML files in a folder, importing each file into the PDF file, and saving as a unique name based off the form field. For example, if I had 5 XML files in the folder, 5 PDF files will be created.


      Does the code below look like it's on the right track, or am I overlooking something?


      //Opens PDF file

      app.openDoc("[PDF file location]");


      // Selects Folder

      var processFolder = Folder('[folder]'); 


      // Get XML files

      var fileList = processFolder.getFiles(/\.(xml)$/i); 


      // Loop through files 

      for (var i = 0; i < fileList.length; i++) { 


      // Process files

           if (fileList[i] instanceof File) { 



      //Save PDF


          myTrustedSpecialTaskFunc(this, "[output folder location]" + [node].rawValue + ".pdf");