Link Search Menu Expand Document

PDF Create Fillable PDF Forms

Create new PDF forms with fillable edit boxes, checkboxes and other fillable fields.

To fill pdf forms or to add text, links, images please check pdf/edit/add endpoint instead.

Available methods

[POST] /pdf/edit/add

You can create fillable PDF form from existing PDF by adding editable text boxes and checkboxes.

adds text, images, 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.

  • 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), input pdf input fields ("type": "textField") or checkboxes ("type": "checkbox"). Sample:
    "annotations":
    [
          {
              "text": "Testing Clickable Links \r\n(CLICK ME!)",
              "x": 200,
              "y": 200,
              "size": 24,
              "pages": "0-",
              "color": "CCBBAA",
              "link": "https://bytescout.com/"
          },
          {
              "text": "Testing Clickable Links \r\n(CLICK ME!)",
              "x": 200,
              "y": 200,
              "size": 24,
              "pages": "0-",
              "color": "CCBBAA",
              "link": "https://bytescout.com/",
              "fontName": "Colibri",
              "fontItalic": true,
              "fontBold": true,
              "fontStrikeout": false,
              "fontUnderline": true,
              "type": "text"
          },
          {
              "text": "sample pdf input field with prefilled text",
              "x": 10,
              "y": 30,
              "size": 12,
              "pages": "0-",
              "type": "TextField",
              "id": "textfield1"
          },
          {
              "x": 100,
              "y": 150,
              "size": 12,
              "pages": "0-",
              "type": "Checkbox",
              "id": "checkbox2"
          }
    ]
    

    See font list for all PDF.co supported fonts.

  • images[] optional. Array of image objects to be added on top of PDF file. Images can be loaded from URL or from URLs for internal file storage. Sample:
    "images": [
          {
              "url": "bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/logo.png",
              "x": 200,
              "y": 250,
              "pages": "0",
              "link": "www.pdf.co"
          }    
    ]
    
  • fields[] optional. Array of values to update filable pdf fields in input pdf. You can create your own automated PDF filler for your pdf forms using this array. Sample:
    "fields: 
    [
          {
              "fieldName": "topmostSubform[0].Page1[0].FilingStatus[0].c1_01[1]",
              "pages": "1",
              "text": "True"
          },
          {
              "fieldName": "topmostSubform[0].Page1[0].FilingStatus[0].c1_01[1]",
              "pages": "1",
              "text": "True"
          }
    ]        
    
  • 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": true,
    "inline": true,
    "name": "newDocument",
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/sample.pdf",
    "annotations":[        
       {
            "text":"sample prefilled text",
            "x": 10,
            "y": 30,
            "size": 12,
            "pages": "0-",
            "type": "TextField",
            "id": "textfield1"
        },
        {
            "x": 100,
            "y": 150,
            "size": 12,
            "pages": "0-",
            "type": "Checkbox",
            "id": "checkbox2"
        },
        {
            "x": 100,
            "y": 170,
            "size": 12,
            "pages": "0-",
            "link": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/logo.png",
            "type": "CheckboxChecked",
            "id":"checkbox3"
        }          
        
    ],
    
    "images": [
        {
            "url": "bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/logo.png",
            "x": 200,
            "y": 250,
            "pages": "0",
            "link": "www.pdf.co"
        }
        
    ]
}

Example responses

POST /pdf/edit/add
{
    "url": "https://pdf-temp-files.s3-us-west-2.amazonaws.com/d5c6efa549194ffaacb2eedd318e0320/newDocument.pdf?X-Amz-Expires=3600&x-amz-security-token=FwoGZXIvYXdzECMaDJJV7qKrpnGUrZHrwSKBATR5rxVlQoU0zj3r4jyHPt7yj4HoCIBi65IbMRWVX8qZZtKL9YGUzP%2FcemlqVd4Vi5%2B80Sg%2BymqQtaQ8qSFqKA82JnV%2BNBDatIigZIZha%2BrQM3jSC%2FZhX1zxsfLLsaH3K5nBnkjT3gi%2FZnx%2FgqrlIhf3m2xRFaTlgHrBADlK9KKPIijSusD4BTIo%2FQ433xx%2FQEaGWdX0nu4NuiByyXNPsBCAI3im9LMUCujjqF79ocyLHA%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA4NRRSZPHCSWKUQ4T/20200716/us-west-2/s3/aws4_request&X-Amz-Date=20200716T092641Z&X-Amz-SignedHeaders=host;x-amz-security-token&X-Amz-Signature=2aa88d39aaf4b5891e4cb42d5675a64486098558d7159b37b75252209bdd6a95",
    "pageCount": 1,
    "error": false,
    "status": 200,
    "name": "newDocument",
    "remainingCredits": 77762
}

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": true,
    "inline": true,
    "name": "newDocument",
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/sample.pdf",
    "annotations":[        
       {
            "text":"sample prefilled text",
            "x": 10,
            "y": 30,
            "size": 12,
            "pages": "0-",
            "type": "TextField",
            "id": "textfield1"
        },
        {
            "x": 100,
            "y": 150,
            "size": 12,
            "pages": "0-",
            "type": "Checkbox",
            "id": "checkbox2"
        },
        {
            "x": 100,
            "y": 170,
            "size": 12,
            "pages": "0-",
            "link": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/logo.png",
            "type": "CheckboxChecked",
            "id":"checkbox3"
        }          
        
    ],
    
    "images": [
        {
            "url": "bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/logo.png",
            "x": 200,
            "y": 250,
            "pages": "0",
            "link": "www.pdf.co"
        }
        
    ]
}'
JavaScript
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("x-api-key", "");

var raw = JSON.stringify({
 "async": false,
 "encrypt": true,
 "inline": true,
 "name": "newDocument",
 "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/sample.pdf",
 "annotations": [
  {
   "text": "sample prefilled text",
   "x": 10,
   "y": 30,
   "size": 12,
   "pages": "0-",
   "type": "TextField",
   "id": "textfield1"
  },
  {
   "x": 100,
   "y": 150,
   "size": 12,
   "pages": "0-",
   "type": "Checkbox",
   "id": "checkbox2"
  },
  {
   "x": 100,
   "y": 170,
   "size": 12,
   "pages": "0-",
   "link": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/logo.png",
   "type": "CheckboxChecked",
   "id": "checkbox3"
  }
 ],
 "images": [
  {
   "url": "bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/logo.png",
   "x": 200,
   "y": 250,
   "pages": "0",
   "link": "www.pdf.co"
  }
 ]
});

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": true,
	 "inline": true,
	 "name": "newDocument",
	 "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/sample.pdf",
	 "annotations": [
	  {
	   "text": "sample prefilled text",
	   "x": 10,
	   "y": 30,
	   "size": 12,
	   "pages": "0-",
	   "type": "TextField",
	   "id": "textfield1"
	  },
	  {
	   "x": 100,
	   "y": 150,
	   "size": 12,
	   "pages": "0-",
	   "type": "Checkbox",
	   "id": "checkbox2"
	  },
	  {
	   "x": 100,
	   "y": 170,
	   "size": 12,
	   "pages": "0-",
	   "link": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/logo.png",
	   "type": "CheckboxChecked",
	   "id": "checkbox3"
	  }
	 ],
	 "images": [
	  {
	   "url": "bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/logo.png",
	   "x": 200,
	   "y": 250,
	   "pages": "0",
	   "link": "www.pdf.co"
	  }
	 ]
	})

};
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": true,
    "inline": true,
    "name": "newDocument",
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/sample.pdf",
    "annotations":[        
       {
            "text":"sample prefilled text",
            "x": 10,
            "y": 30,
            "size": 12,
            "pages": "0-",
            "type": "TextField",
            "id": "textfield1"
        },
        {
            "x": 100,
            "y": 150,
            "size": 12,
            "pages": "0-",
            "type": "Checkbox",
            "id": "checkbox2"
        },
        {
            "x": 100,
            "y": 170,
            "size": 12,
            "pages": "0-",
            "link": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/logo.png",
            "type": "CheckboxChecked",
            "id":"checkbox3"
        }          
        
    ],
    
    "images": [
        {
            "url": "bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/logo.png",
            "x": 200,
            "y": 250,
            "pages": "0",
            "link": "www.pdf.co"
        }
        
    ]
}',
	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\": true,\n    \"inline\": true,\n    \"name\": \"newDocument\",\n    \"url\": \"https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/sample.pdf\",\n    \"annotations\":[        \n       {\n            \"text\":\"sample prefilled text\",\n            \"x\": 10,\n            \"y\": 30,\n            \"size\": 12,\n            \"pages\": \"0-\",\n            \"type\": \"TextField\",\n            \"id\": \"textfield1\"\n        },\n        {\n            \"x\": 100,\n            \"y\": 150,\n            \"size\": 12,\n            \"pages\": \"0-\",\n            \"type\": \"Checkbox\",\n            \"id\": \"checkbox2\"\n        },\n        {\n            \"x\": 100,\n            \"y\": 170,\n            \"size\": 12,\n            \"pages\": \"0-\",\n            \"link\": \"https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/logo.png\",\n            \"type\": \"CheckboxChecked\",\n            \"id\":\"checkbox3\"\n        }          \n        \n    ],\n    \n    \"images\": [\n        {\n            \"url\": \"bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/logo.png\",\n            \"x\": 200,\n            \"y\": 250,\n            \"pages\": \"0\",\n            \"link\": \"www.pdf.co\"\n        }\n        \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"": true," + "\n" +
			@"    ""inline"": true," + "\n" +
			@"    ""name"": ""newDocument""," + "\n" +
			@"    ""url"": ""https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/sample.pdf""," + "\n" +
			@"    ""annotations"":[        " + "\n" +
			@"       {" + "\n" +
			@"            ""text"":""sample prefilled text""," + "\n" +
			@"            ""x"": 10," + "\n" +
			@"            ""y"": 30," + "\n" +
			@"            ""size"": 12," + "\n" +
			@"            ""pages"": ""0-""," + "\n" +
			@"            ""type"": ""TextField""," + "\n" +
			@"            ""id"": ""textfield1""" + "\n" +
			@"        }," + "\n" +
			@"        {" + "\n" +
			@"            ""x"": 100," + "\n" +
			@"            ""y"": 150," + "\n" +
			@"            ""size"": 12," + "\n" +
			@"            ""pages"": ""0-""," + "\n" +
			@"            ""type"": ""Checkbox""," + "\n" +
			@"            ""id"": ""checkbox2""" + "\n" +
			@"        }," + "\n" +
			@"        {" + "\n" +
			@"            ""x"": 100," + "\n" +
			@"            ""y"": 170," + "\n" +
			@"            ""size"": 12," + "\n" +
			@"            ""pages"": ""0-""," + "\n" +
			@"            ""link"": ""https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/logo.png""," + "\n" +
			@"            ""type"": ""CheckboxChecked""," + "\n" +
			@"            ""id"":""checkbox3""" + "\n" +
			@"        }          " + "\n" +
			@"        " + "\n" +
			@"    ]," + "\n" +
			@"    " + "\n" +
			@"    ""images"": [" + "\n" +
			@"        {" + "\n" +
			@"            ""url"": ""bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/logo.png""," + "\n" +
			@"            ""x"": 200," + "\n" +
			@"            ""y"": 250," + "\n" +
			@"            ""pages"": ""0""," + "\n" +
			@"            ""link"": ""www.pdf.co""" + "\n" +
			@"        }" + "\n" +
			@"        " + "\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": True,
 "inline": True,
 "name": "newDocument",
 "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/sample.pdf",
 "annotations": [
  {
   "text": "sample prefilled text",
   "x": 10,
   "y": 30,
   "size": 12,
   "pages": "0-",
   "type": "TextField",
   "id": "textfield1"
  },
  {
   "x": 100,
   "y": 150,
   "size": 12,
   "pages": "0-",
   "type": "Checkbox",
   "id": "checkbox2"
  },
  {
   "x": 100,
   "y": 170,
   "size": 12,
   "pages": "0-",
   "link": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/logo.png",
   "type": "CheckboxChecked",
   "id": "checkbox3"
  }
 ],
 "images": [
  {
   "url": "bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/logo.png",
   "x": 200,
   "y": 250,
   "pages": "0",
   "link": "www.pdf.co"
  }
 ]
})
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`": true,`n    `"inline`": true,`n    `"name`": `"newDocument`",`n    `"url`": `"https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/sample.pdf`",`n    `"annotations`":[        `n       {`n            `"text`":`"sample prefilled text`",`n            `"x`": 10,`n            `"y`": 30,`n            `"size`": 12,`n            `"pages`": `"0-`",`n            `"type`": `"TextField`",`n            `"id`": `"textfield1`"`n        },`n        {`n            `"x`": 100,`n            `"y`": 150,`n            `"size`": 12,`n            `"pages`": `"0-`",`n            `"type`": `"Checkbox`",`n            `"id`": `"checkbox2`"`n        },`n        {`n            `"x`": 100,`n            `"y`": 170,`n            `"size`": 12,`n            `"pages`": `"0-`",`n            `"link`": `"https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/logo.png`",`n            `"type`": `"CheckboxChecked`",`n            `"id`":`"checkbox3`"`n        }          `n        `n    ],`n    `n    `"images`": [`n        {`n            `"url`": `"bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-edit/logo.png`",`n            `"x`": 200,`n            `"y`": 250,`n            `"pages`": `"0`",`n            `"link`": `"www.pdf.co`"`n        }`n        `n    ]`n}"

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