What can you do with it?

Fill PDF forms with text fields, checkboxes, and dropdowns using robust fallback strategies. Handles complex PDF structures where field names don’t match visible labels, with multiple methods for reliable form completion.

How to use it?

Basic Command Structure

/pdf-form-filler
pdf file: the PDF form to fill
form data: the data to fill into the form

Parameters

  • pdf file: URL of the PDF form to fill or PDF content to upload
  • form data: Object containing field names and values to fill
  • field mapping (optional): Custom mapping between data keys and PDF field names
  • fallback strategy (optional): Method for handling missing fields (skip, error, best-match)

Response Format

Returns a filled PDF as base64 encoded data with metadata including file name and mime type. Uses PDF-lib for reliable form processing.

Examples

Basic Usage

Fill simple PDF form:

/pdf-form-filler
pdf file: https://example.com/application.pdf
form data: {
  "name": "John Doe",
  "email": "john@example.com",
  "phone": "555-1234"
}

Advanced Usage

Fill complex form with checkboxes and dropdowns:

/pdf-form-filler
pdf file: https://example.com/survey.pdf
form data: {
  "firstName": "Jane",
  "lastName": "Smith",
  "agree": true,
  "category": "Premium",
  "subscribe": "checked"
}

From Artifact

Fill PDF form from previous step:

/pdf-form-filler
pdf file: [PDF artifact from previous step]
form data: {
  "applicantName": "Mike Johnson",
  "dateOfBirth": "1990-01-15",
  "hasLicense": true
}

With Custom Mapping

Map data to specific PDF field names:

/pdf-form-filler
pdf file: https://example.com/form.pdf
form data: {
  "customer_name": "Sarah Wilson",
  "contact_email": "sarah@company.com"
}
field mapping: {
  "customer_name": "Name_Field_1",
  "contact_email": "Email_Address"
}

Notes

  • Uses PDF-lib for reliable form processing across different PDF types
  • Implements multiple fallback strategies for field identification
  • Handles text fields, checkboxes, and dropdowns with different methods
  • Automatically categorizes fields by type for optimized processing
  • Provides comprehensive logging for debugging field matching
  • Returns base64 encoded PDF with ‘pdf’ key for proper display
  • Supports similarity matching when exact field names don’t match