How to Populate PDF Form Fields with JSON Data via API
Question details
The user needs to retrieve JSON data from a third-party web API using a script in Adobe Acrobat to automatically populate PDF form fields.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Automating PDF data entry by connecting a PDF document to an external web API that returns predictable JSON.
- Observed behavior
- The goal is to successfully fetch the JSON data, parse it, and map the values to specific PDF form fields using Acrobat JavaScript without security blocks.
Ensure you have advanced knowledge of Acrobat JavaScript (AcroJS), and verify that the third-party API allows cross-origin requests and supports your specific authentication methods.
Use Acrobat JavaScript to Fetch and Map JSON Data
Write a custom script within your PDF to request data from the API, parse the JSON response, and assign the values to your form fields.
Connecting a PDF to a live API requires configuring network access within Acrobat and handling the asynchronous response. Because PDF viewers do not use standard web browsers' JavaScript engines, you must rely on Acrobat-specific networking methods rather than standard fetch APIs.
Identify the exact API endpoint URL. Ensure the server is configured to return predictable JSON data and accept requests from your PDF environment.
Use Acrobat's built-in networking methods (such as Net.HTTP.request) to call the API. You will need to construct the appropriate header and authentication payload in your script.
Once the API returns the data payload, capture it and use standard JSON.parse() to convert the string response into a readable JavaScript object.
Map the parsed JSON values to your PDF fields using the syntax: this.getField("FieldName").value = parsedData.propertyName; replacing 'FieldName' with your actual PDF text box names.

Manage and Fill PDF Forms Easily with WPS Office
While advanced API scripting in Adobe Acrobat requires heavy configuration and bypasses strict security sandboxes, WPS Office provides a lightweight, free, and intuitive platform for editing PDFs, filling out standard forms manually or via data import, and converting documents.
- 1. Open WPS PDF: Launch WPS Office and open your interactive PDF form document.
- 2. Fill out the Form: Click directly on the form fields to type your data or use the text tools to fill out non-interactive documents.
- 3. Export and Share: Save your filled PDF or export it directly to Word or Excel formats for easier data extraction and sharing.

Frequently Asked Questions
Why is my API request blocked in Adobe Acrobat?
Acrobat implements strict cross-domain and network security policies. If your API is not listed in the user's trusted sites or lacks proper authentication configuration within Acrobat's Trust Manager, the outgoing request will be automatically blocked.
Can I use standard web JavaScript like fetch() in a PDF?
No. PDF viewers use a specific JavaScript API (AcroJS) rather than standard browser APIs. You cannot use standard web functions like the fetch() API or XMLHttpRequest; you must use Acrobat-specific methods like Net.HTTP.
How do I find the correct PDF field name to populate?
Open your PDF in form editing mode, right-click the specific text box or form element, and select Properties. The 'Name' field in the general tab is the exact string you must use inside your this.getField("Name") script.




