Skip to main content

Fill a PDF Form - Auto Populate Forms API

PDF4me Fill a PDF Form enables you to fill form fields in PDF documents with data. This API service processes PDF templates and populates form fields with structured data. The API receives PDF templates and form data through REST API calls, utilizing Base64 encoding for secure transmission. With support for dynamic data arrays and flexible output formats, this solution is ideal for document automation and form processing workflows.

Authenticating Your API Request

To access the PDF4me REST API, every request must include proper authentication credentials. Authentication ensures secure communication and validates your identity as an authorized user of the REST API.

Key Features

  • Form Field Filling: Populate PDF form fields with structured data
  • Template Processing: Use PDF templates with predefined form fields
  • Data Array Support: Process form data as JSON arrays
  • Flexible Output: Support for various output types
  • Base64 Encoding: Secure file content transmission using Base64 encoding
  • Simple API Integration: RESTful API designed for automated PDF form processing workflows

REST API Endpoint

The PDF4me REST API uses standard HTTP methods to interact with resources. All PDF form filling operations are performed through a single endpoint:

  • Method: POST
  • Endpoint: /api/v2/FillPdfForm

REST API Parameters

Complete list of parameters for the Fill a PDF Form REST API. Parameters are organized by category for better understanding and implementation.

Important: Parameters marked with an asterisk (*) are required and must be provided for the API to function correctly.

Required Parameters

ParameterTypeDescriptionExample
templateDocContent*Base64The content of the PDF form template encoded in Base64 formatJVBERi...
templateDocName*StringPDF form template file name with .pdf extensionform.pdf
dataArray*StringJSON string with form field valuesSee Request Example below
outputType*StringOutput type (must be "pdf")pdf
inputDataType*StringInput data type (must be "json")json
InputFormData*ArrayArray of form field objects with fieldName and fieldValueSee Request Example below

Optional Parameters

ParameterTypeDescriptionExample
metaDataStringAdditional metadata (optional)""
metaDataJsonStringAdditional JSON metadata (optional)""
asyncBooleanEnable asynchronous processing. When true, the API returns a 202 status and provides a polling URL in the Location headertrue

Output

The PDF4me Fill a PDF Form REST API returns different responses based on the processing mode. The API returns the PDF as binary data for synchronous processing or provides a polling URL for asynchronous processing.

Synchronous Processing (Default)

When async is not set or set to false, the API processes the request immediately:

Status Code: 200 OK

Content-Type: application/pdf or application/octet-stream

Response Body:

The API returns the PDF file directly as binary data (not JSON).

How to Use:

  1. The response body contains the binary PDF data
  2. Save the response content directly as a PDF file
  3. No Base64 decoding is needed for binary responses

Example (JavaScript):

const response = await fetch(url, options);
const pdfBlob = await response.blob();
// Save or process pdfBlob directly

Request Example

Content-Type: application/json
Authorization: Basic YOUR_BASE64_ENCODED_API_KEY

Note: The API key must be Base64 encoded. Get your API key from the PDF4me Dashboard

Payload

{
"templateDocName": "form.pdf",
"templateDocContent": "JVBERi...",
"dataArray": "{\"firstname\": \"John\", \"lastname\": \"Adams\", \"gender\": \"Male\"}",
"outputType": "pdf",
"inputDataType": "json",
"InputFormData": [
{"fieldName": "firstname", "fieldValue": "John"},
{"fieldName": "lastname", "fieldValue": "Adams"},
{"fieldName": "gender", "fieldValue": "Male"}
],
"metaData": "",
"metaDataJson": "",
"async": true
}

Code Samples

The PDF4me Fill a PDF Form REST API provides code samples in multiple programming languages. Choose the language that best fits your development environment:

C# (CSharp) Sample

Complete C# implementation for filling PDF forms:

Form Filling Features

Dynamic Data Processing

  • Data Array Support: Process multiple data sets for batch form generation
  • Template Recognition: Intelligent recognition of form fields in PDF templates
  • Data Mapping: Accurate mapping of data to corresponding form fields
  • Professional Results: High-quality form filling with precise field population
  • Advanced Processing: Support for complex form layouts and multiple field types

Template Management

  • PDF Templates: Use predefined PDF templates with form fields for consistent document generation
  • Field Recognition: Automatic recognition and mapping of form fields in templates
  • Data Integration: Seamless integration of structured data with template fields
  • Professional Generation: High-quality document generation with accurate form filling
  • Flexible Templates: Support for various template formats and field types

Advanced Features

  • Metadata Processing: Include custom metadata and JSON data for enhanced document processing
  • Batch Operations: Generate multiple documents from single template with different data sets
  • Custom Data Types: Support for various input data formats and structures
  • Professional Processing: High-quality data processing with accurate field mapping
  • Flexible Options: Customizable processing parameters for specific requirements

Industry Use Cases & Applications

Legal & Professional Services Use Cases

  • Contract Generation: Fill contract templates with client and project data
  • Legal Document Processing: Automatically fill legal forms with case data
  • Client Documentation: Generate filled forms from client information databases
  • Compliance Forms: Fill compliance and regulatory forms automatically

Get Help