Prompt
What should I use to fill and flatten PDF forms automatically?
Latest observation
Oct 15, 2026
OpenAI APIWeb search: off
To fill and flatten PDF forms automatically, the best tool depends on what kind of forms you have and what language/environment you’re using.
Good options
1. Python: pypdf
- Great for filling AcroForm fields.
- Can also flatten in many workflows by regenerating the PDF output, though true flattening can be a bit limited depending on the form.
- Good if you want a simple script.
2. Python: pdfrw + reportlab
- Common combo for filling PDF form fields and overlaying content.
- Useful when you need more control over appearance.
- Flattening is usually done by drawing filled values onto a new layer and removing form fields.
3. Python: PyMuPDF (fitz)
- Very good for editing PDFs, drawing text directly onto pages, and producing flattened output.
- Often easier for true flattening because you can place text on the page rather than relying on form fields.
4. JavaScript/Node: pdf-lib
- Excellent for filling forms in code.
- Supports flattening with
form.flatten(). - A strong choice if you're working in Node.js.
5. Commercial tools
If you need high reliability for complex PDFs:
- Adobe Acrobat SDK
- Apryse (PDFTron)
- iText (Java/.NET; commercial for many uses)
These are often better for tricky forms, signatures, or documents with complex appearance streams.
If you want the simplest recommendation
- Node.js: use
pdf-lib - Python: use
PyMuPDForpypdf - Enterprise / complex PDFs: use Apryse or Adobe
Important note
“Flattening” usually means:
- form fields become static page content
- users can no longer edit them
- text stays visible when printed/viewed everywhere
If you tell me:
- your language (Python/Node/etc.),
- whether the forms are AcroForm or XFA,
- and whether you need true flattening,
I can recommend the best library and show a code example.