What it does
Flattens PDF form fields, annotations and layer content into static page content, making the document non‑editable while preserving its appearance.
Inputs and limits
- Input: a single PDF file uploaded or provided via URL.
- The tool processes any standard PDF; there are no explicit size limits mentioned in the documentation.
Web app
The web page asks you to Upload a PDF to flatten. After uploading, the service merges layers, forms and annotations into a single static document. Options are available to keep or remove specific fields.
Client configuration (the key comes from your Documentize account):
{
"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:
{
"name": "flatten_document",
"arguments": {
"fileUrl": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
}
}
Command line (CLI)
The Documentize.Flatten CLI plugin flattens PDF form fields. Provide the PDF in the task‑input folder; the plugin writes the flattened PDF to the task‑output folder. Options:
--skip-fields– comma‑separated field names to leave un‑flattened (default: none)--flatten-only-fields– comma‑separated field names to flatten exclusively (default: none)
# 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.Flatten.dll --task-id job1
ls "$PLUGIN_OUTPUT_DIR/job1"
# 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.Flatten.dll --task-id job1
Get-ChildItem "$env:PLUGIN_OUTPUT_DIR\job1"
MCP
The hosted MCP tool FlattenDocument flattens form fields and annotations from a PDF available at a public URL.
Parameters:
fileUrl(required) – public URL of the PDF to flattenskipFields(optional) – comma‑separated field names to skipflattenOnlyFields(optional) – comma‑separated field names to flatten exclusively
Client configuration (the key comes from your Documentize account):
{
"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:
{
"name": "flatten_document",
"arguments": {
"fileUrl": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
}
}
Aspose.PDF.FOSS (C#)
The sample uses Aspose.PDF.FOSS to load a PDF, flatten its interactive elements, and save the result.
#:package Aspose.PDF.FOSS@26.11.0
using Aspose.Pdf;
var inputDir = args[0];
var outputDir = args[1];
var inputFile = Directory.GetFiles(inputDir, "*.pdf").First();
var doc = new Document(inputFile);
// Convert form fields and annotations to static page content
if (doc.Form != null) doc.Flatten(); // Aspose flatten method
var outputPath = Path.Combine(outputDir, "flattened.pdf");
doc.Save(outputPath);
Console.WriteLine("flattened.pdf 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:
- Flatten MCP sample (hosted MCP server): passed in 10 s
- Flatten CLI sample (CLI plugin): passed in 4 s
- Flatten C# FOSS sample (Aspose.PDF.FOSS): passed in 6 s