Link Search Menu Expand Document

PDF Fill PDF Forms

PDF filler for fillable PDF forms using PDF.co.

To find names of PDF form fields names, please use this interactive tool.

To get the list of all fillable fields inside PDF form, please use /pdf/info/fields endpoint.

If you need to create your own fillable form then please check PDF Create Fillable PDF Forms topic.

Available methods

[POST] /pdf/edit/add

Add text, images, signatures, text fields, unchecked checkbox, checked checkbox to existing PDF file. You can fill out out existing PDF forms and documents and create new fillable PDF forms using this method.

To find X and Y coordinates for placing text, images or objects please use special PDF viewer displaying X and Y coordinates.

To save image or pdf for re-use as a template please use link from Dropbox or Google Drive or from other storage. Or use built-in PDF.co Files storage. If you need to draw a signature and save as image then use this page.

Objects

  • url required. URL to the source file. Supports links from Google Drive, Dropbox and from built-in PDF.co files storage. For uploading files via API please check Files Upload section. If you are randomly getting Too Many Requests or Access Denied error for your input url, please try to add cache: to enable built-in url caching.

  • annotations[]. optional. Array of text objects to be added on top of pdf. Text objects can be ready-only ("type": "text" by default) or interactive as input fields ("type": "textField") or checkboxes ("type": "checkbox").

Params for annotations objects:

  • text - string to addd
  • x - X coordinate (zero point at left top, use this viewer to measure coordinates.
  • y - X coordinate (zero point at left top, use this viewer to measure coordinates.
  • width (optional) - width of the text box (zero point at left top, use this viewer to measure coordinates.
  • height (optional) - width of the text box (zero point at left top, use this viewer to measure coordinates.
  • pages - comma-separated indices of pages (or page ranges) that you want to use. The first page indice is always 0. For example, if you have a 7 page document that you want split into 3 separate PDFs but different number of pages it would go like this: 0, 1, 2- or 1, 2, 3-7 which will result in 1 PDF with page one, 1 PDF with page two and one PDF with the rest of the pages. You can also use inverted page numbers adding ‘!’ before the number. E.g. “!0” means “the last page”, “1-!1” means “from the second to the penultimate page”, “!1-“ - last two pages”. Also, you can use a single asterisk (“*”) character as the range to split the document into separate pages. SPECIAL CASES: You can use a single asterisk * symbol to split the document into separate pages. Parameter must be a String.
  • color (optional, default is black) - color for the text.
  • link (optional) - sets link on click for text.
  • size (optional, default is 12) - set font size.
  • fontName (optional, default is Arial) - sets font name to use.
  • fontBold (optional, default is false) - set to true to enable bold font style.
  • fontStrikeout (optional, default is false) - set to true to enable strikeout font style.
  • fontUnderline (optional, default is false) - set to true to enable underline font style.
  • type (optional, default is text). Set object type, available types: text = text object, textfield = text input field, checkbox = checkbox field.
  • id (optional) - sets id of the form field if type is not text.

See the font list for all PDF.co supported fonts.

Images

  • images[] optional. Array of image urls (also can be a link to Files storage or datauri link) to be added on top of PDF file. Images can be loaded from URL or from URLs for internal file storage.

Params for Images objects:

  • url - url to image as http link, filetoken or datauri:.. url (with base64 encoded image).
  • x - X coordinate (zero point at left top, use this viewer to measure coordinates.
  • y - X coordinate (zero point at left top, use this viewer to measure coordinates.
  • width (optional) - width of the text box (zero point at left top, use this viewer to measure coordinates.
  • height (optional) - width of the text box (zero point at left top, use this viewer to measure coordinates.
  • pages - comma-separated indices of pages (or page ranges) that you want to use. The first page indice is always 0. For example, if you have a 7 page document that you want split into 3 separate PDFs but different number of pages it would go like this: 0, 1, 2- or 1, 2, 3-7 which will result in 1 PDF with page one, 1 PDF with page two and one PDF with the rest of the pages. You can also use inverted page numbers adding ‘!’ before the number. E.g. “!0” means “the last page”, “1-!1” means “from the second to the penultimate page”, “!1-“ - last two pages”. Also, you can use a single asterisk (“*”) character as the range to split the document into separate pages. SPECIAL CASES: You can use a single asterisk * symbol to split the document into separate pages. Parameter must be a String.
  • link (optional) - link to open on click.

Fields

  • fields[] optional. Array of values to update fillable pdf fields in input pdf. You can create your own automated PDF filler for your pdf forms using this array.

params for Fields objects

  • fieldName - name of the form field. Find form field names using this pdf info tool
  • pages - page index where this form field appears.
  • text - value to set for this field. If you have checkbox, set X, true, 1 or another text which is different from false to enable checkbox. For radioboxes and dropdowns you need to set index of the item to select. Explore pdf form fields in your pdf using this pdf info tool

other params

  • password optional. Password of PDF file. Must be a String.

  • async optional. Runs processing asynchronously. Returns Use JobId that you may use with /job/check to check state of the processing (possible states: working, failed, aborted and success). Must be one of: true, false. IMPORTANT: Also set inline param to true to get direct link to final output pdf in both sync and async modes. Otherwise, you will be getting direct link to pdf in sync mode but also link to .json file in the async mode.

  • inline optional. Set to true to get direct link to output pdf in async mode (otherwise you will get link to json with url inside when you use async mode).

  • encrypt optional. Enable encryption for output file. Must be one of: true, false.

  • name optional. File name for generated output. Must be a String.

  • profiles optional. Must be a String. You can set additional and extra options using this parameter that allows you to set custom configuration. See profiles samples for examples. For example, to flatten pdf form, set profiles to this value: { 'FlattenDocument()': [] }

Description

  • Method: POST
  • URL: /v1/pdf/edit/add

Query parameters

No query parameters accepted.

Body payload

{
    "async": false,
    "encrypt": false,
    "inline": true,
    "name": "f1040-filled",
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-form/f1040.pdf",
    "fields": [
        {
            "fieldName": "topmostSubform[0].Page1[0].FilingStatus[0].c1_01[1]",
            "pages": "1",
            "text": "True"
        },
        {
            "fieldName": "topmostSubform[0].Page1[0].f1_02[0]",
            "pages": "1",
            "text": "John A."
        },        
        {
            "fieldName": "topmostSubform[0].Page1[0].f1_03[0]",
            "pages": "1",
            "text": "Doe"
        },        
        {
            "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_04[0]",
            "pages": "1",
            "text": "123456789"
        },
        {
            "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_05[0]",
            "pages": "1",
            "text": "Joan B."
        },
        {
            "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_05[0]",
            "pages": "1",
            "text": "Joan B."
        },
        {
            "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_06[0]",
            "pages": "1",
            "text": "Doe"
        },
        {
            "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_07[0]",
            "pages": "1",
            "text": "987654321"
        }     



    ],
    "annotations":[
        {
            "text":"Sample Filled with PDF.co API using /pdf/edit/add. Get fields from forms using /pdf/info/fields. This text is be added on the first (0) and the last (!0) pages.",
            "x": 400,
            "y": 10,
            "width": 200,
            "height": 500,
            "size": 12,            
            "pages": "0,!0",
            "color": "FF0000",
            "link": "https://pdf.co"
        }
    ],    
    "images": [        
    ]
}

Example responses

/pdf/edit/add
{
    "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
    "url": "https://pdf-temp-files.s3.amazonaws.com/51ce841adaf94326aff536412d051b02/f1040-filled.pdf",
    "pageCount": 3,
    "error": false,
    "status": 200,
    "name": "f1040-filled",
    "remainingCredits": 326614,
    "credits": 63
}

Code Snippets

CURL
curl --location --request POST 'https://api.pdf.co/v1/pdf/edit/add' \
--header 'Content-Type: application/json' \
--header 'x-api-key: ' \
--data-raw '{
    "async": false,
    "encrypt": false,
    "inline": true,
    "name": "f1040-filled",
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-form/f1040.pdf",
    "fields": [
        {
            "fieldName": "topmostSubform[0].Page1[0].FilingStatus[0].c1_01[1]",
            "pages": "1",
            "text": "True"
        },
        {
            "fieldName": "topmostSubform[0].Page1[0].f1_02[0]",
            "pages": "1",
            "text": "John A."
        },        
        {
            "fieldName": "topmostSubform[0].Page1[0].f1_03[0]",
            "pages": "1",
            "text": "Doe"
        },        
        {
            "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_04[0]",
            "pages": "1",
            "text": "123456789"
        },
        {
            "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_05[0]",
            "pages": "1",
            "text": "Joan B."
        },
        {
            "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_05[0]",
            "pages": "1",
            "text": "Joan B."
        },
        {
            "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_06[0]",
            "pages": "1",
            "text": "Doe"
        },
        {
            "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_07[0]",
            "pages": "1",
            "text": "987654321"
        }     



    ],
    "annotations":[
        {
            "text":"Sample Filled with PDF.co API using /pdf/edit/add. Get fields from forms using /pdf/info/fields. This text is be added on the first (0) and the last (!0) pages.",
            "x": 400,
            "y": 10,
            "width": 200,
            "height": 500,
            "size": 12,            
            "pages": "0,!0",
            "color": "FF0000",
            "link": "https://pdf.co"
        }
    ],    
    "images": [        
    ]
}'
JavaScript
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("x-api-key", "");

var raw = JSON.stringify({
 "async": false,
 "encrypt": false,
 "inline": true,
 "name": "f1040-filled",
 "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-form/f1040.pdf",
 "fields": [
  {
   "fieldName": "topmostSubform[0].Page1[0].FilingStatus[0].c1_01[1]",
   "pages": "1",
   "text": "True"
  },
  {
   "fieldName": "topmostSubform[0].Page1[0].f1_02[0]",
   "pages": "1",
   "text": "John A."
  },
  {
   "fieldName": "topmostSubform[0].Page1[0].f1_03[0]",
   "pages": "1",
   "text": "Doe"
  },
  {
   "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_04[0]",
   "pages": "1",
   "text": "123456789"
  },
  {
   "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_05[0]",
   "pages": "1",
   "text": "Joan B."
  },
  {
   "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_05[0]",
   "pages": "1",
   "text": "Joan B."
  },
  {
   "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_06[0]",
   "pages": "1",
   "text": "Doe"
  },
  {
   "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_07[0]",
   "pages": "1",
   "text": "987654321"
  }
 ],
 "annotations": [
  {
   "text": "Sample Filled with PDF.co API using /pdf/edit/add. Get fields from forms using /pdf/info/fields. This text is be added on the first (0) and the last (!0) pages.",
   "x": 400,
   "y": 10,
   "width": 200,
   "height": 500,
   "size": 12,
   "pages": "0,!0",
   "color": "FF0000",
   "link": "https://pdf.co"
  }
 ],
 "images": []
});

var requestOptions = {
	method: 'POST',
	headers: myHeaders,
	body: raw,
	redirect: 'follow'
};

fetch("https://api.pdf.co/v1/pdf/edit/add", requestOptions)
	.then(response => response.text())
	.then(result => console.log(result))
	.catch(error => console.log('error', error));
NodeJs
var request = require('request');
var options = {
	'method': 'POST',
	'url': 'https://api.pdf.co/v1/pdf/edit/add',
	'headers': {
		'Content-Type': 'application/json',
		'x-api-key': ''
	},
	body: JSON.stringify({
	 "async": false,
	 "encrypt": false,
	 "inline": true,
	 "name": "f1040-filled",
	 "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-form/f1040.pdf",
	 "fields": [
	  {
	   "fieldName": "topmostSubform[0].Page1[0].FilingStatus[0].c1_01[1]",
	   "pages": "1",
	   "text": "True"
	  },
	  {
	   "fieldName": "topmostSubform[0].Page1[0].f1_02[0]",
	   "pages": "1",
	   "text": "John A."
	  },
	  {
	   "fieldName": "topmostSubform[0].Page1[0].f1_03[0]",
	   "pages": "1",
	   "text": "Doe"
	  },
	  {
	   "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_04[0]",
	   "pages": "1",
	   "text": "123456789"
	  },
	  {
	   "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_05[0]",
	   "pages": "1",
	   "text": "Joan B."
	  },
	  {
	   "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_05[0]",
	   "pages": "1",
	   "text": "Joan B."
	  },
	  {
	   "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_06[0]",
	   "pages": "1",
	   "text": "Doe"
	  },
	  {
	   "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_07[0]",
	   "pages": "1",
	   "text": "987654321"
	  }
	 ],
	 "annotations": [
	  {
	   "text": "Sample Filled with PDF.co API using /pdf/edit/add. Get fields from forms using /pdf/info/fields. This text is be added on the first (0) and the last (!0) pages.",
	   "x": 400,
	   "y": 10,
	   "width": 200,
	   "height": 500,
	   "size": 12,
	   "pages": "0,!0",
	   "color": "FF0000",
	   "link": "https://pdf.co"
	  }
	 ],
	 "images": []
	})

};
request(options, function (error, response) {
	if (error) throw new Error(error);
	console.log(response.body);
});

PHP
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
	CURLOPT_URL => 'https://api.pdf.co/v1/pdf/edit/add',
	CURLOPT_RETURNTRANSFER => true,
	CURLOPT_ENCODING => '',
	CURLOPT_MAXREDIRS => 10,
	CURLOPT_TIMEOUT => 0,
	CURLOPT_FOLLOWLOCATION => true,
	CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
	CURLOPT_CUSTOMREQUEST => 'POST',
	CURLOPT_POSTFIELDS =>'{
    "async": false,
    "encrypt": false,
    "inline": true,
    "name": "f1040-filled",
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-form/f1040.pdf",
    "fields": [
        {
            "fieldName": "topmostSubform[0].Page1[0].FilingStatus[0].c1_01[1]",
            "pages": "1",
            "text": "True"
        },
        {
            "fieldName": "topmostSubform[0].Page1[0].f1_02[0]",
            "pages": "1",
            "text": "John A."
        },        
        {
            "fieldName": "topmostSubform[0].Page1[0].f1_03[0]",
            "pages": "1",
            "text": "Doe"
        },        
        {
            "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_04[0]",
            "pages": "1",
            "text": "123456789"
        },
        {
            "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_05[0]",
            "pages": "1",
            "text": "Joan B."
        },
        {
            "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_05[0]",
            "pages": "1",
            "text": "Joan B."
        },
        {
            "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_06[0]",
            "pages": "1",
            "text": "Doe"
        },
        {
            "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_07[0]",
            "pages": "1",
            "text": "987654321"
        }     



    ],
    "annotations":[
        {
            "text":"Sample Filled with PDF.co API using /pdf/edit/add. Get fields from forms using /pdf/info/fields. This text is be added on the first (0) and the last (!0) pages.",
            "x": 400,
            "y": 10,
            "width": 200,
            "height": 500,
            "size": 12,            
            "pages": "0,!0",
            "color": "FF0000",
            "link": "https://pdf.co"
        }
    ],    
    "images": [        
    ]
}',
	CURLOPT_HTTPHEADER => array(
		'Content-Type: application/json',
		'x-api-key: '
	),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Java
import java.io.*;
import okhttp3.*;
public class main {
	public static void main(String []args) throws IOException{
		OkHttpClient client = new OkHttpClient().newBuilder()
			.build();
		MediaType mediaType = MediaType.parse("application/json");
		RequestBody body = RequestBody.create(mediaType, "{\n    \"async\": false,\n    \"encrypt\": false,\n    \"inline\": true,\n    \"name\": \"f1040-filled\",\n    \"url\": \"https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-form/f1040.pdf\",\n    \"fields\": [\n        {\n            \"fieldName\": \"topmostSubform[0].Page1[0].FilingStatus[0].c1_01[1]\",\n            \"pages\": \"1\",\n            \"text\": \"True\"\n        },\n        {\n            \"fieldName\": \"topmostSubform[0].Page1[0].f1_02[0]\",\n            \"pages\": \"1\",\n            \"text\": \"John A.\"\n        },        \n        {\n            \"fieldName\": \"topmostSubform[0].Page1[0].f1_03[0]\",\n            \"pages\": \"1\",\n            \"text\": \"Doe\"\n        },        \n        {\n            \"fieldName\": \"topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_04[0]\",\n            \"pages\": \"1\",\n            \"text\": \"123456789\"\n        },\n        {\n            \"fieldName\": \"topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_05[0]\",\n            \"pages\": \"1\",\n            \"text\": \"Joan B.\"\n        },\n        {\n            \"fieldName\": \"topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_05[0]\",\n            \"pages\": \"1\",\n            \"text\": \"Joan B.\"\n        },\n        {\n            \"fieldName\": \"topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_06[0]\",\n            \"pages\": \"1\",\n            \"text\": \"Doe\"\n        },\n        {\n            \"fieldName\": \"topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_07[0]\",\n            \"pages\": \"1\",\n            \"text\": \"987654321\"\n        }     \n\n\n\n    ],\n    \"annotations\":[\n        {\n            \"text\":\"Sample Filled with PDF.co API using /pdf/edit/add. Get fields from forms using /pdf/info/fields. This text is be added on the first (0) and the last (!0) pages.\",\n            \"x\": 400,\n            \"y\": 10,\n            \"width\": 200,\n            \"height\": 500,\n            \"size\": 12,            \n            \"pages\": \"0,!0\",\n            \"color\": \"FF0000\",\n            \"link\": \"https://pdf.co\"\n        }\n    ],    \n    \"images\": [        \n    ]\n}");
		Request request = new Request.Builder()
			.url("https://api.pdf.co/v1/pdf/edit/add")
			.method("POST", body)
			.addHeader("Content-Type", "application/json")
			.addHeader("x-api-key", "")
			.build();
		Response response = client.newCall(request).execute();
		System.out.println(response.body().string());
	}
}

C#
using System;
using RestSharp;
namespace HelloWorldApplication {
	class HelloWorld {
		static void Main(string[] args) {
			var client = new RestClient("https://api.pdf.co/v1/pdf/edit/add");
			client.Timeout = -1;
			var request = new RestRequest(Method.POST);
			request.AddHeader("Content-Type", "application/json");
			request.AddHeader("x-api-key", "");
			var body = @"{" + "\n" +
			@"    ""async"": false," + "\n" +
			@"    ""encrypt"": false," + "\n" +
			@"    ""inline"": true," + "\n" +
			@"    ""name"": ""f1040-filled""," + "\n" +
			@"    ""url"": ""https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-form/f1040.pdf""," + "\n" +
			@"    ""fields"": [" + "\n" +
			@"        {" + "\n" +
			@"            ""fieldName"": ""topmostSubform[0].Page1[0].FilingStatus[0].c1_01[1]""," + "\n" +
			@"            ""pages"": ""1""," + "\n" +
			@"            ""text"": ""True""" + "\n" +
			@"        }," + "\n" +
			@"        {" + "\n" +
			@"            ""fieldName"": ""topmostSubform[0].Page1[0].f1_02[0]""," + "\n" +
			@"            ""pages"": ""1""," + "\n" +
			@"            ""text"": ""John A.""" + "\n" +
			@"        },        " + "\n" +
			@"        {" + "\n" +
			@"            ""fieldName"": ""topmostSubform[0].Page1[0].f1_03[0]""," + "\n" +
			@"            ""pages"": ""1""," + "\n" +
			@"            ""text"": ""Doe""" + "\n" +
			@"        },        " + "\n" +
			@"        {" + "\n" +
			@"            ""fieldName"": ""topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_04[0]""," + "\n" +
			@"            ""pages"": ""1""," + "\n" +
			@"            ""text"": ""123456789""" + "\n" +
			@"        }," + "\n" +
			@"        {" + "\n" +
			@"            ""fieldName"": ""topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_05[0]""," + "\n" +
			@"            ""pages"": ""1""," + "\n" +
			@"            ""text"": ""Joan B.""" + "\n" +
			@"        }," + "\n" +
			@"        {" + "\n" +
			@"            ""fieldName"": ""topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_05[0]""," + "\n" +
			@"            ""pages"": ""1""," + "\n" +
			@"            ""text"": ""Joan B.""" + "\n" +
			@"        }," + "\n" +
			@"        {" + "\n" +
			@"            ""fieldName"": ""topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_06[0]""," + "\n" +
			@"            ""pages"": ""1""," + "\n" +
			@"            ""text"": ""Doe""" + "\n" +
			@"        }," + "\n" +
			@"        {" + "\n" +
			@"            ""fieldName"": ""topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_07[0]""," + "\n" +
			@"            ""pages"": ""1""," + "\n" +
			@"            ""text"": ""987654321""" + "\n" +
			@"        }     " + "\n" +
			@"" + "\n" +
			@"" + "\n" +
			@"" + "\n" +
			@"    ]," + "\n" +
			@"    ""annotations"":[" + "\n" +
			@"        {" + "\n" +
			@"            ""text"":""Sample Filled with PDF.co API using /pdf/edit/add. Get fields from forms using /pdf/info/fields. This text is be added on the first (0) and the last (!0) pages.""," + "\n" +
			@"            ""x"": 400," + "\n" +
			@"            ""y"": 10," + "\n" +
			@"            ""width"": 200," + "\n" +
			@"            ""height"": 500," + "\n" +
			@"            ""size"": 12,            " + "\n" +
			@"            ""pages"": ""0,!0""," + "\n" +
			@"            ""color"": ""FF0000""," + "\n" +
			@"            ""link"": ""https://pdf.co""" + "\n" +
			@"        }" + "\n" +
			@"    ],    " + "\n" +
			@"    ""images"": [        " + "\n" +
			@"    ]" + "\n" +
			@"}";
			request.AddParameter("application/json", body,  ParameterType.RequestBody);
			IRestResponse response = client.Execute(request);
			Console.WriteLine(response.Content);
		}
	}
}

Python
import requests
import json

url = "https://api.pdf.co/v1/pdf/edit/add"

payload = json.dumps({
 "async": False,
 "encrypt": False,
 "inline": True,
 "name": "f1040-filled",
 "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-form/f1040.pdf",
 "fields": [
  {
   "fieldName": "topmostSubform[0].Page1[0].FilingStatus[0].c1_01[1]",
   "pages": "1",
   "text": "True"
  },
  {
   "fieldName": "topmostSubform[0].Page1[0].f1_02[0]",
   "pages": "1",
   "text": "John A."
  },
  {
   "fieldName": "topmostSubform[0].Page1[0].f1_03[0]",
   "pages": "1",
   "text": "Doe"
  },
  {
   "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_04[0]",
   "pages": "1",
   "text": "123456789"
  },
  {
   "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_05[0]",
   "pages": "1",
   "text": "Joan B."
  },
  {
   "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_05[0]",
   "pages": "1",
   "text": "Joan B."
  },
  {
   "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_06[0]",
   "pages": "1",
   "text": "Doe"
  },
  {
   "fieldName": "topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_07[0]",
   "pages": "1",
   "text": "987654321"
  }
 ],
 "annotations": [
  {
   "text": "Sample Filled with PDF.co API using /pdf/edit/add. Get fields from forms using /pdf/info/fields. This text is be added on the first (0) and the last (!0) pages.",
   "x": 400,
   "y": 10,
   "width": 200,
   "height": 500,
   "size": 12,
   "pages": "0,!0",
   "color": "FF0000",
   "link": "https://pdf.co"
  }
 ],
 "images": []
})
headers = {
	'Content-Type': 'application/json',
	'x-api-key': ''
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Powershell
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", "application/json")
$headers.Add("x-api-key", "")

$body = "{`n    `"async`": false,`n    `"encrypt`": false,`n    `"inline`": true,`n    `"name`": `"f1040-filled`",`n    `"url`": `"https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-form/f1040.pdf`",`n    `"fields`": [`n        {`n            `"fieldName`": `"topmostSubform[0].Page1[0].FilingStatus[0].c1_01[1]`",`n            `"pages`": `"1`",`n            `"text`": `"True`"`n        },`n        {`n            `"fieldName`": `"topmostSubform[0].Page1[0].f1_02[0]`",`n            `"pages`": `"1`",`n            `"text`": `"John A.`"`n        },        `n        {`n            `"fieldName`": `"topmostSubform[0].Page1[0].f1_03[0]`",`n            `"pages`": `"1`",`n            `"text`": `"Doe`"`n        },        `n        {`n            `"fieldName`": `"topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_04[0]`",`n            `"pages`": `"1`",`n            `"text`": `"123456789`"`n        },`n        {`n            `"fieldName`": `"topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_05[0]`",`n            `"pages`": `"1`",`n            `"text`": `"Joan B.`"`n        },`n        {`n            `"fieldName`": `"topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_05[0]`",`n            `"pages`": `"1`",`n            `"text`": `"Joan B.`"`n        },`n        {`n            `"fieldName`": `"topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_06[0]`",`n            `"pages`": `"1`",`n            `"text`": `"Doe`"`n        },`n        {`n            `"fieldName`": `"topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_07[0]`",`n            `"pages`": `"1`",`n            `"text`": `"987654321`"`n        }     `n`n`n`n    ],`n    `"annotations`":[`n        {`n            `"text`":`"Sample Filled with PDF.co API using /pdf/edit/add. Get fields from forms using /pdf/info/fields. This text is be added on the first (0) and the last (!0) pages.`",`n            `"x`": 400,`n            `"y`": 10,`n            `"width`": 200,`n            `"height`": 500,`n            `"size`": 12,            `n            `"pages`": `"0,!0`",`n            `"color`": `"FF0000`",`n            `"link`": `"https://pdf.co`"`n        }`n    ],    `n    `"images`": [        `n    ]`n}"

$response = Invoke-RestMethod 'https://api.pdf.co/v1/pdf/edit/add' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json

[POST] /pdf/edit/add (with simplified params)

You can add fill pdf fields in existing PDF PDF forms. This method uses simplified version of /pdf/edit/add.

  • url required. URL to the source file. Supports links from Google Drive, Dropbox and from built-in PDF.co files storage. For uploading files via API please check Files Upload section. If you are randomly getting Too Many Requests or Access Denied error for your input url, please try to add cache: to enable built-in url caching.

  • fieldsString optional. Set values for fillable fields inside pdf forms. Use the following format page;fieldName;value.

Example: 0;editbox1;text is here.

Filling checkbox: for unchecked state please use false, no, not, none, unchecked or 0 . To put a checkmark use X, true or anything else.

Example: 0;checkbox1;true or 0;checkbox1;X

For multiple objects, use | separator.

To get the list of all fillable fields in PDF form please use /pdf/info/fields endpoint or helper tools at https://app.pdf.co/

  • annotationsString optional. Add one or more text objects on top of pdf. Each text object to be added can be described as x;y;pages;text;fontsize;fontname;fontcolor;link;transparent. Sample: 20;20;0-;Testing Text;24;Arial;FF0000;www.pdf.co;false. To separate multiple objects, use | separator. where 24 is the font size. You can also add styles intoto the font size using the following modifiers:
    • +bold for bold style
    • +italic for italic style
    • +underline for underline style
    • +strikeout for strikeout style

    See font list for all PDF.co supported fonts. For example, for font size 24 and bold, italic, underline and strikeout styles:

    250;20;0-;PDF form filled with PDF.co API;24+bold+italic+underline+strikeout;Arial;FF0000;www.pdf.co;true
  • imagesString optional. Adds one or more images on top of pdf. Each image object can be defined as x;y;pages;urltoimage;linkToOpen;width;height for example: 20;80;0-;bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/logo.png;www.pdf.co;200;200. To separate multiple objects, use | separator.

  • password optional. Password of PDF file. Must be a String.

  • async optional. Runs processing asynchronously. Returns Use JobId that you may use with /job/check to check state of the processing (possible states: working, failed, aborted and success). Must be one of: true, false. IMPORTANT: Also set inline param to true to get direct link to final output pdf in both sync and async modes. Otherwise, you will be getting direct link to pdf in sync mode but also link to .json file in the async mode.

  • inline optional. Set to true to get direct link to output pdf in async mode (otherwise you will get link to json with url inside when you use async mode).

  • encrypt optional. Enable encryption for output file. Must be one of: true, false.

  • name optional. File name for generated output. Must be a String.

  • profiles optional. Must be a String. You can set additional and extra options using this parameter that allows you to set custom configuration. See profiles samples for examples.

Description

  • Method: POST
  • URL: /v1/pdf/edit/add

Query parameters

No query parameters accepted.

Body payload

{
    "async": false,
    "encrypt": false,
    "inline": true,
    "name": "f1040-form-filled",
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-form/f1040.pdf",
    "fieldsString": "1;topmostSubform[0].Page1[0].f1_02[0];John A. Doe|1;topmostSubform[0].Page1[0].FilingStatus[0].c1_01[1];true|1;topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_04[0];123456789"
}

Example responses

JSON simplified /pdf/edit/add
{
    "url": "https://pdf-temp-files.s3.amazonaws.com/03c5c55183c74f8d94a4ec952e4e32ad/f1040-form-filled.pdf",
    "pageCount": 3,
    "error": false,
    "status": 200,
    "name": "f1040-form-filled",
    "remainingCredits": 60822
}

Code Snippets

CURL
curl --location --request POST 'https://api.pdf.co/v1/pdf/edit/add' \
--header 'Content-Type: application/json' \
--header 'x-api-key: ' \
--data-raw '{
    "async": false,
    "encrypt": false,
    "inline": true,
    "name": "f1040-form-filled",
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-form/f1040.pdf",
    "fieldsString": "1;topmostSubform[0].Page1[0].f1_02[0];John A. Doe|1;topmostSubform[0].Page1[0].FilingStatus[0].c1_01[1];true|1;topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_04[0];123456789"
}'
JavaScript
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("x-api-key", "");

var raw = JSON.stringify({
 "async": false,
 "encrypt": false,
 "inline": true,
 "name": "f1040-form-filled",
 "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-form/f1040.pdf",
 "fieldsString": "1;topmostSubform[0].Page1[0].f1_02[0];John A. Doe|1;topmostSubform[0].Page1[0].FilingStatus[0].c1_01[1];true|1;topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_04[0];123456789"
});

var requestOptions = {
	method: 'POST',
	headers: myHeaders,
	body: raw,
	redirect: 'follow'
};

fetch("https://api.pdf.co/v1/pdf/edit/add", requestOptions)
	.then(response => response.text())
	.then(result => console.log(result))
	.catch(error => console.log('error', error));
NodeJs
var request = require('request');
var options = {
	'method': 'POST',
	'url': 'https://api.pdf.co/v1/pdf/edit/add',
	'headers': {
		'Content-Type': 'application/json',
		'x-api-key': ''
	},
	body: JSON.stringify({
	 "async": false,
	 "encrypt": false,
	 "inline": true,
	 "name": "f1040-form-filled",
	 "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-form/f1040.pdf",
	 "fieldsString": "1;topmostSubform[0].Page1[0].f1_02[0];John A. Doe|1;topmostSubform[0].Page1[0].FilingStatus[0].c1_01[1];true|1;topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_04[0];123456789"
	})

};
request(options, function (error, response) {
	if (error) throw new Error(error);
	console.log(response.body);
});

PHP
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
	CURLOPT_URL => 'https://api.pdf.co/v1/pdf/edit/add',
	CURLOPT_RETURNTRANSFER => true,
	CURLOPT_ENCODING => '',
	CURLOPT_MAXREDIRS => 10,
	CURLOPT_TIMEOUT => 0,
	CURLOPT_FOLLOWLOCATION => true,
	CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
	CURLOPT_CUSTOMREQUEST => 'POST',
	CURLOPT_POSTFIELDS =>'{
    "async": false,
    "encrypt": false,
    "inline": true,
    "name": "f1040-form-filled",
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-form/f1040.pdf",
    "fieldsString": "1;topmostSubform[0].Page1[0].f1_02[0];John A. Doe|1;topmostSubform[0].Page1[0].FilingStatus[0].c1_01[1];true|1;topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_04[0];123456789"
}',
	CURLOPT_HTTPHEADER => array(
		'Content-Type: application/json',
		'x-api-key: '
	),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

Java
import java.io.*;
import okhttp3.*;
public class main {
	public static void main(String []args) throws IOException{
		OkHttpClient client = new OkHttpClient().newBuilder()
			.build();
		MediaType mediaType = MediaType.parse("application/json");
		RequestBody body = RequestBody.create(mediaType, "{\n    \"async\": false,\n    \"encrypt\": false,\n    \"inline\": true,\n    \"name\": \"f1040-form-filled\",\n    \"url\": \"https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-form/f1040.pdf\",\n    \"fieldsString\": \"1;topmostSubform[0].Page1[0].f1_02[0];John A. Doe|1;topmostSubform[0].Page1[0].FilingStatus[0].c1_01[1];true|1;topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_04[0];123456789\"\n}");
		Request request = new Request.Builder()
			.url("https://api.pdf.co/v1/pdf/edit/add")
			.method("POST", body)
			.addHeader("Content-Type", "application/json")
			.addHeader("x-api-key", "")
			.build();
		Response response = client.newCall(request).execute();
		System.out.println(response.body().string());
	}
}

C#
using System;
using RestSharp;
namespace HelloWorldApplication {
	class HelloWorld {
		static void Main(string[] args) {
			var client = new RestClient("https://api.pdf.co/v1/pdf/edit/add");
			client.Timeout = -1;
			var request = new RestRequest(Method.POST);
			request.AddHeader("Content-Type", "application/json");
			request.AddHeader("x-api-key", "");
			var body = @"{" + "\n" +
			@"    ""async"": false," + "\n" +
			@"    ""encrypt"": false," + "\n" +
			@"    ""inline"": true," + "\n" +
			@"    ""name"": ""f1040-form-filled""," + "\n" +
			@"    ""url"": ""https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-form/f1040.pdf""," + "\n" +
			@"    ""fieldsString"": ""1;topmostSubform[0].Page1[0].f1_02[0];John A. Doe|1;topmostSubform[0].Page1[0].FilingStatus[0].c1_01[1];true|1;topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_04[0];123456789""" + "\n" +
			@"}";
			request.AddParameter("application/json", body,  ParameterType.RequestBody);
			IRestResponse response = client.Execute(request);
			Console.WriteLine(response.Content);
		}
	}
}

Python
import requests
import json

url = "https://api.pdf.co/v1/pdf/edit/add"

payload = json.dumps({
 "async": False,
 "encrypt": False,
 "inline": True,
 "name": "f1040-form-filled",
 "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-form/f1040.pdf",
 "fieldsString": "1;topmostSubform[0].Page1[0].f1_02[0];John A. Doe|1;topmostSubform[0].Page1[0].FilingStatus[0].c1_01[1];true|1;topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_04[0];123456789"
})
headers = {
	'Content-Type': 'application/json',
	'x-api-key': ''
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Powershell
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Content-Type", "application/json")
$headers.Add("x-api-key", "")

$body = "{`n    `"async`": false,`n    `"encrypt`": false,`n    `"inline`": true,`n    `"name`": `"f1040-form-filled`",`n    `"url`": `"https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-form/f1040.pdf`",`n    `"fieldsString`": `"1;topmostSubform[0].Page1[0].f1_02[0];John A. Doe|1;topmostSubform[0].Page1[0].FilingStatus[0].c1_01[1];true|1;topmostSubform[0].Page1[0].YourSocial_ReadOrderControl[0].f1_04[0];123456789`"`n}"

$response = Invoke-RestMethod 'https://api.pdf.co/v1/pdf/edit/add' -Method 'POST' -Headers $headers -Body $body
$response | ConvertTo-Json