Doc Fill icon

Doc Fill

Fill form fields in PDF documents using pdf-lib

Doc Fill

AI-generated

Summary

Fill PDF form fields from input PDFs either by manually mapping fields or by executing custom JavaScript code using pdf-lib, producing updated PDFs as output binaries.

Inputs

  • Mode (required) — Select 'Manual Mapping' to fill PDF forms using a visual field mapper or 'Custom Code' to provide custom pdf-lib JavaScript code for advanced manipulations.
  • Input Binary Property (required) — Name of the binary input property containing the source PDF to fill.
  • Output Binary Property (required) — Name of the binary output property to store the filled PDF.
  • Fields — When in Manual Mapping mode, define PDF form fields to fill, including field name, type, value (supports expressions), and optional coordinate overrides.
  • Custom Code — When in Custom Code mode, enter JavaScript code to manipulate the PDF using pdf-lib APIs; code receives the loaded PDFDocument and current item data, and must return the modified PDFDocument or a full item.
  • Options — Configure processing modes like batch handling ('Single' or 'Per Item'), font embedding, flattening the PDF (making fields non-editable), handling of missing fields, field name matching strategy, output filename formatting, and appearance rebuilding after filling.

Output shape

a list of items matching the input items, each containing the original JSON augmented with optional missing or failed field information, and a binary property with the filled PDF data

Supports processing multiple input items either individually or as a single batch. If 'List Available Fields' is enabled in Manual Mapping, outputs metadata listing the PDF's fillable fields instead of a filled PDF. Errors such as missing required fields or invalid values cause node failure unless 'continue on fail' is set. Output PDFs are saved with provided or original filenames, ensuring .pdf extension.

Examples

Example 1: Fill PDF form fields manually

Set Mode to 'Manual Mapping', specify input and output binary properties, define the mapping of PDF form fields with field names and values, and configure options such as flattening and font embedding.

Example 2: Fill PDF using custom pdf-lib code

Set Mode to 'Custom Code', provide input and output binary properties, and write JavaScript leveraging pdf-lib to manipulate the PDF, then return the modified PDFDocument or custom output.

Discussion