Ahmadreza
Ahmadreza

Reputation: 384

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

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.

Upvotes: 0

Views: 833

Answers (2)

joelgeraci
joelgeraci

Reputation: 4927

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.

Upvotes: 1

Max Wyss
Max Wyss

Reputation: 3605

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.

Upvotes: 1

Related Questions