Skip to main content
Participant
July 14, 2017
Answered

Automating exporting form data to XML

  • July 14, 2017
  • 1 reply
  • 3867 views

Hello all,

I'm working with Adobe Acrobat Pro DC.

I'm currently receiving PDF forms with data already in the fields. I know that I can export this data to XML via "Prepare Forms" -> Tools -> Export Data and saving it as an XML file so that we can process the form data. This is nice, but the thought of having to do this for each individual pdf form we receive is daunting.

I'd like to be able to automate this in some fashion, but I'm relatively new to all of this and not entirely sure where to start. Any help would be appreciated!

This topic has been closed for replies.
Correct answer try67

I'm talking about composing the XML string, and then exporting it to a file.

XFDF is XML-based, so if you can parse an XML file you should be able to parse it as well.

The advantage of XFDF is that there's a built-in command to export the form data to it, which you can use in an Action to process multiple files. The code to use for this is:

this.exportAsXFDF({cPath: this.path.replace(/pdf$/i, "xfdf"});


It will save the generated files in the same folder, and under the same name, as the originals.

1 reply

try67
Community Expert
Community Expert
July 14, 2017

Not sure it's possible with XML (unless you compose the entire thing yourself), but it is possible with XFDF... Will that work for you?

MQNAuthor
Participant
July 14, 2017

Are you talking about composing the form? I'm basically trying to use these to replace a somewhat clunky existing system, so if it's there's some redesign to make it come out nicely into XML that would be fine.

I'm not sure how much more difficult it would be to parse an XFDF file to extract the form data versus an XML file, but I'm feel like it could also be done. If so, that might be good enough.

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
July 14, 2017

I'm talking about composing the XML string, and then exporting it to a file.

XFDF is XML-based, so if you can parse an XML file you should be able to parse it as well.

The advantage of XFDF is that there's a built-in command to export the form data to it, which you can use in an Action to process multiple files. The code to use for this is:

this.exportAsXFDF({cPath: this.path.replace(/pdf$/i, "xfdf"});


It will save the generated files in the same folder, and under the same name, as the originals.