Skip to main content

Add Form Fields to PDF - Interactive Form API

PDF4me Add Form Fields to PDF enables you to add interactive form fields to PDF documents. This API service processes PDF files and adds form fields (text boxes and checkboxes) at specific positions on specified pages. The API receives PDF content and form field parameters through REST API calls, utilizing Base64 encoding for secure transmission. With support for flexible positioning, custom field types, and page targeting, this solution is ideal for document automation and interactive PDF development 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 Types: Add TextBox and CheckBox form fields to PDF documents
  • Precise Positioning: Control field placement with exact X and Y coordinates
  • Custom Field Sizing: Adjust form field dimensions to match design requirements
  • Flexible Page Targeting: Apply form fields to specific pages or entire documents
  • Initial Values: Set default values for form fields
  • Base64 Encoding: Secure file content transmission using Base64 encoding
  • Simple API Integration: RESTful API designed for automated PDF form creation workflows

REST API Endpoint

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

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

REST API Parameters

Complete list of parameters for the Add Form Fields To PDF 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
docContent*Base64The content of the input PDF file encoded in Base64JVBERi...
docName*StringSource PDF file name with .pdf extensionoutput.pdf
initialValue*StringInitial value for the form fieldNew input text
positionX*IntegerX position of the form field on the page300
positionY*IntegerY position of the form field on the page300
fieldName*StringName of the form fieldInput Field Name
Size*IntegerSize of the form field4
pages*StringPage options: "1" for page 1, "1,3,5" for specific pages, "2-5" for page range, "1,3,7-10" for mixed, "1-" for pages from 1 to end1
formFieldType*StringForm field type: TextBox or CheckBoxTextBox

Optional Parameters

ParameterTypeDescriptionExample
asyncBooleanEnable asynchronous processing. When true, the API returns a 202 status and provides a polling URL in the Location headertrue

Output

The PDF4me Add Form Fields to PDF 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

{
"docContent": "Please put PDF base64 content",
"docName": "output.pdf",
"initialValue": "input text",
"positionX": 300,
"positionY": 300,
"fieldName": "Input Field Name",
"Size": 4,
"pages": "1",
"formFieldType": "TextBox"
}

Code Samples

The PDF4me Add Form Fields To PDF 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 adding form fields to PDF:

Form Field Creation Features

Form Field Types

  • TextBox Fields: Create text input fields for user data entry and form completion
  • CheckBox Fields: Add checkbox elements for selection and confirmation options
  • Custom Sizing: Adjust field dimensions to match design requirements and content needs
  • Professional Results: High-quality form field creation with accurate functionality
  • Advanced Processing: Support for complex form layouts and field arrangements

Positioning and Layout

  • Precise Coordinates: Control field placement with exact X and Y position values
  • Flexible Positioning: Support for any page position and field arrangement
  • Page Targeting: Apply form fields to specific pages or entire documents
  • Custom Sizing: Adjustable field dimensions for optimal form design
  • Professional Layout: Consistent form field placement across all target pages

Advanced Features

  • Initial Values: Set default field values for improved user experience
  • Field Naming: Custom field names for form data collection and processing
  • Professional Creation: High-quality form field generation with clear functionality
  • Flexible Options: Customizable form field parameters for specific requirements

Industry Use Cases & Applications

Legal & Professional Services Use Cases

  • Contract Forms: Add form fields to contracts and agreements for digital signatures
  • Legal Documentation: Create interactive forms for legal document processing
  • Compliance Forms: Build forms for regulatory compliance and documentation
  • Client Intake: Create client intake forms for legal services

Get Help