pdf-form-fill

Fill PDF forms in n8n using pdf-lib

Package Information

Downloads: 1 weekly / 30 monthly
Latest Version: 1.2.1
Author: thomas_martin

Documentation

n8n-nodes-pdf-form-fill

This is an n8n community node that allows you to fill PDF forms using the powerful pdf-lib library.

Features

  • Fill PDF Form Fields: Support for text fields, checkboxes, dropdowns, radio groups, dates, and numbers
  • Multiple Match Modes: Exact, case-insensitive, regex, or fuzzy field name matching
  • Coordinate Override: Write text at specific coordinates when form fields don't exist
  • List Fields: Discover all available fields in a PDF before filling
  • Custom Font Support: Embed standard fonts for UTF-8 character support
  • Flexible Output: Flatten forms, rebuild appearances, customize output filenames
  • Batch Processing: Process multiple items individually or together
  • Error Handling: Choose to ignore missing fields or fail strictly
  • n8n Expression Support: Use expressions like ={{$json.name}} for dynamic values

Installation

Via n8n UI (Recommended)

  1. Go to SettingsCommunity Nodes
  2. Click Install
  3. Enter: n8n-nodes-pdf-form-fill
  4. Click Install
  5. Restart n8n

Via npm

cd ~/.n8n/custom
npm install n8n-nodes-pdf-form-fill

Then restart n8n.

Usage

  1. Add a HTTP Request node or Read Binary File node to get your PDF
  2. Add the Doc Fill node
  3. Configure fields to fill:
    • Field Name: The exact name of the field in the PDF form
    • Field Type: Text Field, Checkbox, Dropdown, Radio Group, Date, or Number
    • Value: The value to insert (supports n8n expressions like ={{$json.name}})
  4. Execute the workflow

The output will contain the filled PDF in the binary data.

Quick Example

{
  "fields": [
    { "key": "firstName", "type": "textfield", "value": "={{$json.firstName}}" },
    { "key": "lastName", "type": "textfield", "value": "={{$json.lastName}}" },
    { "key": "email", "type": "textfield", "value": "={{$json.email}}" },
    { "key": "agreeToTerms", "type": "checkbox", "value": "={{$json.agree}}" }
  ],
  "options": {
    "flatten": true,
    "embedFont": "helvetica"
  }
}

Options

  • Flatten PDF: Make form fields non-editable after filling
  • Ignore Missing Fields: Skip fields that don't exist instead of throwing an error
  • Match Mode: How to match field names (exact, case-insensitive, regex, fuzzy)
  • Rebuild Appearances: Refresh visual appearance of form fields
  • Embed Font: Support UTF-8 characters (Helvetica, Courier, Times Roman)
  • Output Filename: Custom filename with expression support
  • Strict Mode: Fail on any invalid field name or type
  • List Available Fields: Discover all field names in the PDF

Documentation

For detailed documentation, examples, and troubleshooting, see the DocFill README.

Requirements

  • Node.js 20.15 or newer
  • Self-hosted n8n instance (custom nodes don't work on n8n Cloud)

License

MIT

Resources

Discussion