PDF Generator API icon

PDF Generator API

Generate PDFs, manage templates, convert HTML/URLs to PDF, and perform PDF operations like watermarking, encryption, and optimization

Overview

The "Fill Form Fields" operation of the PDF Service resource allows users to programmatically fill interactive form fields within an existing PDF document. This node accepts a PDF either from a public URL or as base64-encoded content, along with a JSON object specifying the form field names and their corresponding values to populate. The output can be returned in various formats including base64 JSON, binary file data, or a downloadable URL.

This operation is beneficial when automating workflows that require dynamic filling of PDF forms, such as generating completed contracts, applications, surveys, or invoices based on user input or external data sources.

Practical example:
You have a PDF form template for a job application. Using this node, you can supply applicant data as JSON (e.g., name, email, address) and automatically generate a filled PDF form ready for review or submission.


Properties

Name Meaning
PDF Source Select the source of the PDF document to process: From URL (public URL) or From Base64 (base64 encoded content).
PDF URL Public URL to the PDF document (required if PDF Source is "From URL").
PDF Base64 Base64 encoded PDF content (required if PDF Source is "From Base64").
Output Format Choose the output format of the filled PDF: Base64 (JSON) returns JSON with base64 string; File (Binary) returns binary file data for download/attachment; URL (JSON) returns JSON with a download URL.
Form Fields Data JSON object containing key-value pairs where keys are form field names and values are the data to fill into those fields. Example: {"firstName": "John", "lastName": "Doe", "email": "john.doe@example.com"}

Output

The node outputs the filled PDF document according to the selected output format:

  • Base64 (JSON): JSON response containing a base64-encoded string of the filled PDF.
  • File (Binary): Binary data of the filled PDF file, suitable for direct download or attachment in subsequent workflow steps.
  • URL (JSON): JSON response containing a URL where the filled PDF can be downloaded.

Additionally, the output JSON includes metadata such as success status and operation name.


Dependencies

  • Requires an API key credential for authenticating with the external PDF Generator API service.
  • The node makes HTTP POST requests to the /pdfservices/form/fill endpoint of the API.
  • The API base URL defaults to https://us1.pdfgeneratorapi.com/api/v4 but can be configured via credentials.
  • Proper network access to the public PDF URL (if using URL source) or valid base64 content must be ensured.

Troubleshooting

  • Invalid JSON in Form Fields Data:
    Error message: "Form Fields Data must be valid JSON"
    Resolution: Ensure the JSON string provided for form fields is correctly formatted and parseable.

  • Missing Required Parameters:
    If the PDF source is URL but no URL is provided, or if base64 source is selected but no base64 content is given, the node will throw errors indicating missing required inputs. Verify all required fields are populated.

  • Unsupported Output Format:
    Selecting an unsupported output format may cause unexpected behavior. Use one of the documented options: base64, file, or url.

  • API Authentication Errors:
    If the API key credential is invalid or missing, the node will fail to authenticate. Confirm the API key is correctly configured in n8n credentials.

  • Network Issues:
    If the PDF URL is inaccessible or the API endpoint cannot be reached, the node will error out. Check network connectivity and URL accessibility.


Links and References

Discussion