# Extract form data from PDF: web app, CLI, MCP and C# (FOSS)

## What it does
Extracts the values of interactive form fields (text boxes, checkboxes, radio buttons, dropdowns, etc.) from a fillable PDF form and outputs them as CSV files.

## Inputs and limits
* Input: a PDF file that contains AcroForm or XFA form fields.  
* The tool works with fillable PDFs; scanned or non‑interactive PDFs need OCR first and may not produce results.  
* No explicit size limit is documented; the CLI and libraries process files that fit into available memory.

## Web app
Upload a PDF form on the page **Extract Form Data from PDF**. The service extracts the field values and returns CSV files with the form data.

## Command line (CLI)
Run the Documentize.ExtractFormData plugin, placing the PDF in the task’s input folder and specifying a task ID. The plugin writes CSV files with the extracted fields to the output folder.  
```bash
# Linux / macOS (needs the .NET 10 runtime and documentize.lic next to the DLL)
export PLUGIN_INPUT_DIR=./work/input
export PLUGIN_OUTPUT_DIR=./work/output
mkdir -p "$PLUGIN_INPUT_DIR/job1"
cp form.pdf "$PLUGIN_INPUT_DIR/job1/"
dotnet Documentize.ExtractFormData.dll --task-id job1
ls "$PLUGIN_OUTPUT_DIR/job1"
```

```powershell
# Windows PowerShell
$env:PLUGIN_INPUT_DIR  = "$PWD\work\input"
$env:PLUGIN_OUTPUT_DIR = "$PWD\work\output"
New-Item -ItemType Directory -Force "$env:PLUGIN_INPUT_DIR\job1" | Out-Null
Copy-Item form.pdf "$env:PLUGIN_INPUT_DIR\job1\"
dotnet Documentize.ExtractFormData.dll --task-id job1
Get-ChildItem "$env:PLUGIN_OUTPUT_DIR\job1"
```

## MCP
Call the hosted MCP tool **ExtractFormData** with a public URL of the PDF form. The service returns a task ID and, upon completion, provides CSV files containing the form data.  
Client configuration (the key comes from your Documentize account):

```json
{
  "mcpServers": {
    "documentize": {
      "url": "https://api.documentize.app/mcp",
      "headers": {
        "Authorization": "Bearer dmk_YOUR_KEY_HERE"
      }
    }
  }
}
```

Tool call (`tools/call`). The tool returns a task id; poll `get_task_status` until it reports 200, then download the file from `uploadFileName`:

```json
{
  "name": "extract_form_data",
  "arguments": {
    "fileUrl": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
  }
}
```

## Aspose.PDF.FOSS (C#)
A C# program using the Aspose.PDF.FOSS library loads the PDF, iterates over its form fields, and writes a CSV file with field names and values.  
```csharp
#:package Aspose.PDF.FOSS@26.11.0

using Aspose.Pdf;
using System.IO;

var inputDir = args[0];
var outputDir = args[1];
var inputFile = Path.Combine(inputDir, "form.pdf");
var doc = new Document(inputFile);
using var writer = new StreamWriter(Path.Combine(outputDir, "form_fields.csv"));
writer.WriteLine("FieldName,Value");
foreach (var field in doc.Form.Fields)
{
    writer.WriteLine($"{field.PartialName},{field.Value}");
}
Console.WriteLine("form_fields.csv written");
```

Save it as `app.cs` and run `dotnet run app.cs -- ./in ./out` (.NET 10 SDK).

## Verified

Every code sample on this page was run on 2026-11-03 and its result was checked:

- Extract form data via CLI with content check (CLI plugin): passed in 1 s
- Extract form data via MCP with content check (hosted MCP server): passed in 6 s
- Extract form data via Aspose.PDF.FOSS with content check (Aspose.PDF.FOSS): passed in 10 s
