PDF Editing Issues

How to Export Acrobat PDF Form Fields to CSV in Visual Order

Elise WilliamsElise Williams Nov 2, 2026 868 views

Question details

The user needs to export all form fields from a PDF, including field IDs, into a CSV file. Crucially, the fields must be sorted by their physical visual reading order on the page rather than their creation sequence.

How to Export Acrobat Form Fields and IDs to CSV in Visual Layout Order
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Extracting and analyzing PDF form data where the structured physical layout of the document is required for correct processing.
Observed behavior
By default, Acrobat exports form data based on the annotation (Annots) array order, which rigidly reflects when fields were added to the document rather than how they are currently arranged on the page.
Before you start

Ensure you have Adobe Acrobat Pro installed, as the standard Adobe Reader does not support the execution of advanced document-level JavaScript required to extract and sort field coordinates.

Solution 1Recommended

Use Acrobat JavaScript to Extract and Sort Fields

Deploy a custom JavaScript snippet to iterate through the PDF form fields, extract their exact page coordinates, sort them visually, and output the customized data sequence to a CSV.

Because Adobe Acrobat relies on the Annots array for its standard data exports, mapping form fields to a customized visual arrangement requires executing a script. By utilizing Acrobat JavaScript, you can read the 'rect' property of each form field to determine its precise physical location on the document.

Sorting these collected coordinates allows you to override the default creation order and structure your CSV data strictly by top-to-bottom and left-to-right alignments.

1
Open the JavaScript Console

In Adobe Acrobat Pro, navigate to 'Tools' > 'JavaScript' and select 'Document JavaScripts', or press Ctrl+J to open the interactive JavaScript Debugger Console.

2
Iterate through form fields

Write a scripting loop utilizing the 'this.getNthFieldName(i)' method to programmatically collect every field's name and ID present in the document.

3
Retrieve coordinate data

For each captured field, use 'this.getField(name).rect' to capture the bounding box coordinates (top, left, bottom, right) alongside the associated page number.

4
Sort the collected fields

Apply a custom JavaScript sorting function to your collected field array, sorting primarily by the Y-coordinate (top-to-bottom) and secondarily by the X-coordinate (left-to-right).

5
Output to CSV format

Format the sorted array into a standard comma-separated string format. You can print this string directly to the console window to copy, or use a data object to save the resulting CSV.

Use Acrobat JavaScript to Extract and Sort Fields
Alternative Method Limitation: The built-in 'Export Data' function under Acrobat's 'Prepare Form' tool will permanently use the default Annots array order. It cannot be configured through settings to use visual order without custom scripting.
Efficient PDF Data Extraction

Seamlessly Convert PDF Forms to Excel and CSV with WPS Office

If writing JavaScript code to extract PDF form data is too complex, WPS Office provides an intuitive PDF to Excel conversion tool that accurately captures visual document layouts and automatically structures them into clean spreadsheets.

  1. 1. Open the PDF document: Launch WPS Office and open your PDF file containing the target form fields.
  2. 2. Navigate to PDF to Excel: Click on the 'Tools' tab in the top navigation ribbon and select the 'PDF to Excel' conversion feature.
  3. 3. Convert and save as CSV: Follow the prompts to convert the visual layout of the PDF into a spreadsheet. Once opened in WPS Spreadsheet, easily select 'Save As' to export the structured data as a CSV file.
Convert PDF form visuals directly into structured spreadsheets with one single click.High compatibility with Microsoft Office formats, ensuring exported Excel and CSV files open flawlessly in Microsoft Excel.User-friendly interface requiring absolutely no programming or JavaScript knowledge.Lightweight, fast, and fully supports standard interactive PDF form capabilities.
QA img-9

Frequently Asked Questions

Why does Acrobat export form fields out of order?

Acrobat exports data strictly in the order the form fields were originally created. This internal sequence is stored in the PDF document's Annots array and does not automatically update when you physically drag or move fields around on the visual page.

How can I view a specific form field's ID in Acrobat?

Enter the 'Prepare Form' mode from the Tools menu, right-click the specific form field in question, and select 'Properties'. The 'Name' text box located at the top of the General tab acts as the field's internal ID.

Can I manually reorder the Annots array instead of writing JavaScript?

Acrobat does not provide a native drag-and-drop user interface tool to modify the internal Annots array order. Re-creating the form fields entirely from scratch in the desired sequence or using a custom Javascript are the only native methods to manipulate the export flow.