Extract values of a PDF form to a XML file using JS actions in Adobe Acrobat

546 Views Asked by At

I'm trying to get values of some specific form fields and then generate a XML file based on that data using JS actions when a user clicks a button in Adobe Acrobat. It's possible to get those values but I'm not sure how to generate that xml and provide it to the user. I do check these documents but can't find anything related:

https://www.adobe.com/devnet-docs/acrobatetk/tools/Mobile/iosapi/files/Doc.js.html

https://www.adobe.com/devnet-docs/acrobatetk/tools/Mobile/iosapi/files/App.js.html

https://www.adobe.com/devnet-docs/acrobatetk/tools/Mobile/iosapi/files/Util.js.html

https://www.adobe.com/devnet-docs/acrobatetk/tools/Mobile/iosapi/files/Event.js.html

https://www.adobe.com/devnet-docs/acrobatetk/tools/Mobile/iosapi/files/Field.js.html

Any help would be appreciated.

2

There are 2 best solutions below

0
Max Wyss On BEST ANSWER

If it is "just an XML", you could export as XFDF, which is the XML representation of FDF, the Forms Data File.

Otherwise, you could create a (hidden) multiline text field, and assemble the XML, which you can then export.

0
joelgeraci On

Add the following JavaScript to the Mouse Up event of your button. enter image description here

this.exportAsXFDF();

The user will be prompted to date the data as an XFDF file which is XML.