reading xml data into a pdf and populating form fields


i saw old post, 2 years old, thom parker saying can't done.  can read xml, not populate form fields.  i'm using acrobat 7, still case?  need find way write out bunch of info in text file , read pdf , fill in fields.  what's best way that?

 

thanks,

stan

you mean want read xml file pdf document extract xml values , populate form fields should help, but

im doing script folder level,

 

what have xml file called test.xml on local file system, contains folowing xml

 

 

<?xml version="1.0" encoding="utf-8" ?>

    <session>
    <details>
           <name>kyle</name>
           <datetime>thu jun 4 2009</datetime>
  </details>
</session>
then have folder level script, attach same code button, if wanted
user first click on button or field populate fields on form.
var importtestxml = app.trustedfunction(
  function() {
      app.beginpriv();
     
        try {
          this.importdataobject("mydata", "/c/test.xml");
         
          // objects contents
          var odb = this.getdataobjectcontents("mydata");
         
          // convert string
          var cdb = util.stringfromstream(odb, "utf-8");
          console.println("convereted: " + cdb);
         
          // send function strip xml nodes
          var myxml = xmldata.parse(cdb, false);
         
          // extract xml node values this
          var tname = myxml.session.details.name;
          var tdate = myxml.session.details.datetime;
         
          // populate form fileds this
          this.getfield("edtfirstname").value = tname.value;
          this.getfield("edtdate").value = tdate.value;

        } catch (e) {
          app.alert(e);
          console.println(e);
        }     
        app.endpriv();
  }
);

 



More discussions in JavaScript


adobe

Comments

Popular posts from this blog

Error compiling for board Arduino/Genuino Uno.

Installation database is corrupt

esp8266 (nodemcu 0.9) client.write très lent ???