How to Import XFDF Data from a Web Server into Acrobat PDF
Question details
The user is unable to import XFDF data into an Acrobat PDF form when the file is hosted on a web server generated by PHP, despite it working with local files.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Attempting to populate a PDF form dynamically using XFDF data generated by a server-side script.
- Observed behavior
- The importAnXFDF() method fails when using a server URL, though it successfully imports XFDF data from local file paths.
Ensure you have access to edit the JavaScript in your PDF form and that your web server is properly configured to return data with the correct XFDF content type.
Replace importAnXFDF() with doc.submitForm()
Since importAnXFDF() is restricted to local file paths, doc.submitForm() must be used to interact with web servers and retrieve HTTP response data.
The importAnXFDF() method is strictly designed for the local file system. To import data from a web server, you must use doc.submitForm() instead. By default, this function performs an HTTP POST request, but it can also execute a GET request. The server must return the XFDF data directly in the HTTP response body.
Open your PDF form in Adobe Acrobat, access the JavaScript editor, and replace the importAnXFDF() call with doc.submitForm({ cURL: 'YOUR_SERVER_URL' });.
Update your server-side script (such as PHP or Node.js) to output the generated XFDF data directly into the HTTP response body.
Ensure your server sets the correct Content-Type header (e.g., application/vnd.adobe.xfdf) so Acrobat correctly interprets the incoming data.

Edit and Manage PDF Forms Easily with WPS Office
While scripting server-side XFDF data imports requires advanced Acrobat JavaScript features, for everyday PDF form editing, creating, and filling, WPS Office offers a comprehensive, lightweight, and cost-effective solution.
- 1. Download and install: Visit the official WPS Office website and download the free desktop application.
- 2. Open your PDF: Launch WPS Office and drag your PDF form into the workspace to open it.
- 3. Edit and fill forms: Use the dedicated PDF toolkit to interact with form fields, add annotations, or modify text directly.

Frequently Asked Questions
Why does importAnXFDF() work locally but not on a server?
The importAnXFDF() function in Acrobat JavaScript is explicitly designed for the local file system. It expects a local file path and does not support HTTP or HTTPS network requests.
What HTTP method does doc.submitForm() use?
By default, doc.submitForm() uses a POST request. However, it can be configured to use a GET request by adjusting the parameters in your JavaScript call.
Why is my Acrobat PDF blocking the server connection?
Adobe Acrobat has built-in security features that prevent unauthorized network access. You may need to add your server's domain to the 'Privileged Locations' or 'Trusted Sites' within Acrobat's Security (Enhanced) preferences.




