🍋
Menu
PDF

Flattening

PDF Flattening

The process of merging interactive elements (forms, annotations) into the static page content of a PDF.

Technical Detail

PDF Flattenings use the AcroForm or XFA specification to define widgets that capture user input. AcroForm fields support text, checkboxes, radio buttons, dropdowns, and signature fields with built-in JavaScript validation. Each field stores its value separately from the visual appearance, allowing programmatic extraction and pre-filling. XFA (XML Forms Architecture) offers more dynamic layouts but is deprecated in PDF 2.0 in favor of AcroForm.

Example

```javascript
// Fill PDF form fields
const form = pdf.getForm();
form.getTextField('name').setText('Jane Doe');
form.getCheckBox('agree').check();
form.getDropdown('country').select('United States');

// Flatten form (make fields non-editable)
form.flatten();
```

Related Formats

Related Tools

Related Terms