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.

Related Blog Posts
No blog post yet for this feature — coming soon.
In the meantime, browse the PDF4me blog for tutorials and workflows across every platform.
Visit the blog →

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.

ParameterRequiredWhat it doesExample
jobIdExtOptionalYour own reference for this call. It is stored with the API call log so you can correlate calls with your jobs. Type: string.
integrationsOptionalIntegration identifiers, forwarded unchanged with the job's notification settings. Type: array.
isAsyncOptionalSet to `true` to process the action asynchronously and get a job to poll at `/api/v2/GetActionStatus`. Only honoured by actions that support asynchronous processing. Type: boolean.true
docNameOptionalSource file name including its extension. Several actions dispatch on the extension, so it should always be set; when omitted a per-action default is used. Type: string.output.pdf
docContentRequiredThe source file. Accepts the base64-encoded file content, a `pdf4meblobid://<id>` reference to a previously uploaded blob, or an `https` URL to the source document. Required: an empty value fails with `File is empty`. Type: string.JVBERi...
docContentBytesOptionalAlternative raw byte payload for the source file. Type: string.
callBackUrlOptionalOptional URL notified when an asynchronous job completes. Type: string.
fieldNameOptionalName of the new form field. Type: string.Input Field Name
initialValueOptionalInitial value of the field. For a `CheckBox`, `true` or `1` creates it checked. Type: string.New input text
positionXOptionalHorizontal position of the field on the page. Type: integer.300
positionYOptionalVertical position of the field on the page. Type: integer.300
sizeOptionalSize of the form field. Type: integer.4
pagesOptionalPages to add the field to, e.g. `1`, `1,3,5`, `2-5` or `1-` (1 to the last page). Type: string.1
formFieldTypeOptionalMatched case-insensitively; an unrecognised value falls back to the first entry. Type: string.TextBox

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​