How to Save a PDF Form as XML with a Button in Acrobat
Question details
The user wants to add a clickable button to a PDF form that automatically saves the completed data as an XML file and needs to know if this setup can be easily distributed to multiple users.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Creating an interactive PDF form for multiple users to fill out, where the submitted data needs to be collected in XML format for database integration or automated processing.
- Observed behavior
- Users are looking for a simple, built-in action to output XML via a button, but Acrobat restricts local file saving for security reasons, often requiring custom JavaScript or alternative submission formats like XFDF.
Ensure you have Adobe Acrobat Pro installed, as the free Adobe Reader does not include the tools required to create interactive form buttons, configure submission actions, or add document-level JavaScript.
Use the Built-in XFDF Form Submission Action
Instead of writing complex scripts for raw XML, use Acrobat's built-in form submission feature to export data as XFDF, an XML-based format designed specifically for PDF forms.
XFDF is a highly supported, XML-based format used by Adobe to handle form data and annotations. Setting up a button to submit XFDF is straightforward and natively supported without requiring users to install custom security scripts on their local machines.
Launch Adobe Acrobat Pro, open your PDF form, and select 'Prepare Form' from the right-hand tools pane.
Click the 'Button' icon in the top toolbar and drag it onto your document to create a new interactive button.
Double-click the button to open the Button Properties dialog. Navigate to the 'Actions' tab and set the Select Trigger to 'Mouse Up'.
In the Select Action dropdown, choose 'Submit a form' and click 'Add'. Enter your data collection URL (or a mailto: email address) and select 'XFDF (XML-based FDF)' as the Export Format. Click 'OK' to save.

Write a Custom JavaScript Function for Local XML Export
Use Acrobat's JavaScript engine to build a custom XML string from form fields, though this requires administrative setup for local saving.
Effortlessly Fill and Manage PDF Forms with WPS Office
While configuring custom JavaScript for XML extraction in Adobe Acrobat can be restrictive and difficult to distribute, WPS Office offers a straightforward, user-friendly PDF editor. You can easily fill out, save, and manage interactive PDF forms without dealing with complex scripting or security permissions.
- 1. Open Your PDF Form: Launch WPS Office, click on 'PDF', and open the interactive form document you need to fill out.
- 2. Fill in the Data: Click directly into the highlighted form fields to input your text, select checkboxes, or choose from dropdown menus.
- 3. Save and Share: Once the form is complete, click 'Save' to preserve the entered data locally, or use the 'Share' feature to send the completed PDF directly to your team or clients.

Frequently Asked Questions
What is the difference between XML and XFDF in PDF forms?
XFDF is an XML-based file format specifically designed by Adobe to store PDF form data and annotations. It strictly follows standard XML syntax but utilizes a predefined schema tailored for PDFs, making it the easiest and most reliable way to export form data without writing custom parsing code.
Why won't my JavaScript button save the XML file on another user's computer?
Adobe Acrobat employs a strict security model that prevents standard document-level scripts from accessing or silently writing files to a user's local hard drive. To allow local saving via a button, a trusted 'folder-level' script (.js file) must be manually placed inside the Acrobat installation folder on every individual user's computer.
Can users with the free Adobe Reader execute form submission buttons?
Yes, provided the button is configured using Acrobat's built-in 'Submit a form' action (such as sending XFDF data to an email address or web server). Free Adobe Reader users can successfully click the button and submit the data as long as they have an active internet or email client connection.




