POST /v1/pdf/edit/add
Create new PDF forms with fillable edit boxes, checkboxes and other fillable fields.
Quickly create configs for PDF.co API, Zapier, Make with PDF.co PDF Edit Add Helper.
To add a signature, save the signature as an image and insert it using the images attribute.
Attributes
Attributes are case-sensitive and should be inside JSON for POST request. for example:
{ "url": "https://example.com/file1.pdf" }| Attribute | Type | Required | Default | Description |
|---|---|---|---|---|
url | string | Yes | - | URL to the source file url attribute |
callback | string | No | - | The callback URL (or Webhook) used to receive the POST data. see Webhooks & Callbacks. This is only applicable when async is set to true. |
httpusername | string | No | - | HTTP auth user name if required to access source URL. |
httppassword | string | No | - | HTTP auth password if required to access source URL. |
password | string | No | - | Password for the PDF file. |
name | string | No | - | File name for the generated output, the input must be in string format. |
expiration | integer | No | 60 | Set the expiration time for the output link in minutes. After this specified duration, any generated output file(s) will be automatically deleted from PDF.co Temporary Files Storage. The maximum duration for link expiration varies based on your current subscription plan. To store permanent input files (e.g. re-usable images, pdf templates, documents) consider using PDF.co Built-In Files Storage. |
inline | boolean | No | false | Set to true to return results inside the response. Otherwise, the endpoint will return a URL to the output file generated. |
async | boolean | No | false | Set async to true for long processes to run in the background, API will then return a jobId which you can use with the Background Job Check endpoint. Also see Webhooks & Callbacks |
annotations | array[object] | No | - | |
text | string | Yes | - | String to add, if you need to insert a line break then use \n or {{$$newLine}}. You can also use built-in macros like {{$$PageNumber}} and custom data macros. |
x | integer | Yes | - | X coordinate (zero point is in the top left corner). Use PDF Edit Add Helper to measure coordinates. |
y | integer | Yes | - | Y coordinate (zero point is in the top left corner). Use PDF Edit Add Helper to measure coordinates. |
type | string | No | Text | Set object type. Available types: text = text object (default), textField = text input field, TextFieldMultiline = multiline fillable text field, checkbox = checkbox field. |
id | string | No | - | Sets id of the form field if type is not text. |
leading | integer | No | - | Sets a custom line height for text. The value defines the vertical spacing between lines. Larger values increase the space between lines, while smaller values tighten the spacing. |
width | integer | No | - | Width of the text box. Use PDF Edit Add Helper to measure pdf coordinates. |
height | integer | No | - | Height of the text box. Use PDF Edit Add Helper to measure pdf coordinates. |
alignment | string | No | left | Sets text alignment within the width of the text box. Valid values: left, center, right. Default is left. |
pages | string | No | - | Specify page indices as comma-separated values or ranges to process (e.g. “0, 1, 2-” or “1, 2, 3-7”). The first-page index is 0, Use ”!” before a number for inverted page numbers (e.g. “!0” for the last page). To process all pages, use “0-”. If not specified, the default configuration processes all pages. The input must be in string format. |
color | string | No | #000000 | Sets the text color. Default is #000000 (non-transparent black). Color in RRGGBB or AARRGGBB format where AA is the transparency component. For example, 50% transparent green is #8000FF00. |
link | string | No | - | Sets link on click for text. |
size | integer | No | 12 | Sets font size. |
transparent | boolean | No | true | Set to false to force disable any transparency and draw a white background under the text. |
fontName | string | No | Arial | Set font name to use. Default is “Arial”. See availabe fonts. |
fontBold | boolean | No | false | Set to true to enable bold font style. |
fontStrikeout | boolean | No | false | Set to true to enable strikeout font style. |
fontUnderline | boolean | No | false | Set to true to enable underline font style. |
RotationAngle | integer | No | 0 | Set rotation angle in degrees. Default is 0 degrees. |
images | array[object] | No | - | |
url | string | Yes | - | URL to image or PDF as HTTP link, file token, or datauri:.. URL (with base64 encoded image). |
x | integer | Yes | - | X coordinate (zero point is in the top left corner). Use PDF Edit Add Helper to measure coordinates. |
y | integer | Yes | - | Y coordinate (zero point is in the top left corner). Use PDF Edit Add Helper to measure pdf coordinates. |
width | integer | No | - | Width of the text box. Use PDF Edit Add Helper to measure pdf coordinates. |
height | integer | No | - | Height of the text box. Use PDF Edit Add Helper to measure pdf coordinates. |
pages | string | No | - | Specify page indices as comma-separated values or ranges to process (e.g. “0, 1, 2-” or “1, 2, 3-7”). The first-page index is 0, Use ”!” before a number for inverted page numbers (e.g. “!0” for the last page). To process all pages, use “0-”. If not specified, the default configuration processes all pages. The input must be in string format. |
link | string | No | - | Sets link on click for text. |
keepAspectRatio | boolean | No | true | Set to false if don’t need to keep the aspect ratio for the image or PDF added. In this case, it will use the width and height parameters provided. |
fields | array[object] | No | - | |
fieldName | string | Yes | - | Name of the form field. To find form fields please use PDF Edit Add Helper. |
text | string | Yes | - | Value to set for this field. If you have a checkbox, set X, true, 1, or another text which is different from false to enable the checkbox. For radio buttons and combo boxes, you need to set the item value in text or index of the item to select. To find form fields please use PDF Edit Add Helper. |
pages | string | No | - | Specify page indices as comma-separated values or ranges to process (e.g. “0, 1, 2-” or “1, 2, 3-7”). The first-page index is 0, Use ”!” before a number for inverted page numbers (e.g. “!0” for the last page). To process all pages, use “0-”. If not specified, the default configuration processes all pages. The input must be in string format. |
size | integer | No | - | Override the font size of the text inside the given input field. |
fontName | string | No | - | Name of the font to use to fill out the input field. |
fontBold | boolean | No | - | Override font bold style of the text input field. |
fontItalic | boolean | No | - | Override font italic style of the text input field. |
fontStrikeout | boolean | No | - | Override font strikeout style of the text input field. |
fontUnderline | boolean | No | - | Override font underline style of the text input field. |
annotationsString | string | No | - | This parameter represents one or more text objects to add to a PDF. Each object is made of parameter separated by the ; symbol. |
imagesString | string | No | - | Adds one or more images or other PDF objects on top of the source PDF. Each object is made of parameter separated by the ; symbol. |
fieldsString | string | No | - | Set values for fillable PDF field objects. Each object is made of parameter separated by the ; symbol. See fieldsString for more information. |
profiles | object | No | - | - |
outputDataFormat | string | No | - | If you require your output as base64 format, set this to base64 |
Pages[0].SetCropBox() | array[string] | No | - | Crop a PDF file using an array to define the crop area. The crop box is defined by a rectangle [x, y, width, height] in PDF points (1 Point = 1/72 inches). |
DisableLigatures | boolean | No | false | To disable ligaturization, for example for Hebrew, use the following: |
FlattenDocument() | boolean | No | false | Flattening a document renders it as read-only. Handy if you want to remove editing or copying capability. |
DataEncryptionAlgorithm | string | No | - | Controls the encryption algorithm used for data encryption. See User-Controlled Encryption for more information. The available algorithms are: AES128, AES192, AES256. |
DataEncryptionKey | string | No | - | Controls the encryption key used for data encryption. See User-Controlled Encryption for more information. |
DataEncryptionIV | string | No | - | Controls the encryption IV used for data encryption. See User-Controlled Encryption for more information. |
DataDecryptionAlgorithm | string | No | - | Controls the decryption algorithm used for data decryption. See User-Controlled Encryption for more information. The available algorithms are: AES128, AES192, AES256. |
DataDecryptionKey | string | No | - | Controls the decryption key used for data decryption. See User-Controlled Encryption for more information. |
DataDecryptionIV | string | No | - | Controls the decryption IV used for data decryption. See User-Controlled Encryption for more information. |
fieldsString
Set values for fillable PDF fields (i.e. fill pdf fields in pdf forms). To fill fields in PDF form, use the following format:page;fieldName;value.
Also, the advanced format can be used to override font name, size and style:
0;fieldName;Field Text;12+bold+italic+underline+strikeout;FontName
Where:
0;editbox1;text is here;12+bold;Arial
To fill the checkbox, use true, for example: 0;checkbox1;true.
To separate multiple objects, use the | separator. To get the list of all fillable fields in a PDF form, use the :ref:post-tag-pdf-info-fields endpoint. If you need to include a pipe character within a value, escape it by prefixing with \\ (for example, | should be written as \\| and in a JSON string as \\|).
Crop a PDF File
Crop a PDF file using an array to define the crop area. The crop box is defined by a rectangle[x, y, width, height] in PDF points (1 Point = 1/72 inches).
An A4 page size in points is 595 x 842
Disable Ligaturization
To disable ligaturization, for example for Hebrew, use the following:Flatten Document
Flattening a document renders it as read-only. Handy if you want to remove editing or copying capability.Available fonts
Standard Fonts
- Arial
- Arial Black
- Aptos
- Aptos Display
- Aptos Narrow
- Bahnschrift
- Calibri
- Cambria
- Cambria Math
- Candara
- Comic Sans MS
- Consolas
- Constantia
- Corbel
- Courier New
- Ebrima
- Franklin Gothic Medium
- Gabriola
- Gadugi
- Georgia
- HoloLens MDL2 Assets
- Impact
- Ink Free
- Javanese Text
- Leelawadee UI
- Lucida Console
- Lucida Sans Unicode
- Malgun Gothic
- Marlett
- Microsoft Himalaya
- Microsoft JhengHei
- Microsoft New Tai Lue
- Microsoft PhagsPa
- Microsoft Sans Serif
- Microsoft Tai Le
- Microsoft YaHei
- Montserrat
- Microsoft Yi Baiti
- MingLiU-ExtB
- Mongolian Baiti
- MS Gothic
- MV Boli
- Myanmar Text
- OCR A
- OCR A Extended
- OCR B
- OCR B E
- OCR B F
- OCR B L
- OCR B S
- OCR X S
- Nirmala UI
- Palatino Linotype
- Segoe MDL2 Assets
- Segoe Print
- Segoe Script
- Segoe UI
- Segoe UI Historic
- Segoe UI Emoji
- Segoe UI Symbol
- SimSun
- Sitka
- Sylfaen
- Symbol
- Tahoma
- Times New Roman
- Trebuchet MS
- Verdana
- Webdings
- Wingdings
- Yu Gothic
Japanese Fonts
- MS Gothic
- MS Mincho
- Yu Gothic
Chinese Fonts
- SimSun
- MingLiU
- Microsoft YaHei
Korean Fonts
- Malgun Gothic
Hebrew Fonts
- Miriam
Arabic Fonts
- Aldhabi
- Andalus
- Arabic Typesetting
Query parameters
No query parameters accepted.Responses
| Parameter | Type | Description |
|---|---|---|
hash | string | Hash of the final PDF file stored in S3. |
url | string | Direct URL to the final PDF file stored in S3. |
error | boolean | Indicates whether an error occurred (false means success) |
pageCount | integer | Number of pages in the PDF document. |
status | string | Status code of the request (200, 404, 500, etc.). For more information, see Response Codes. |
name | string | Name of the output file |
remainingCredits | integer | Number of credits remaining in the account |
credits | integer | Number of credits consumed by the request |
duration | integer | Time taken for the operation in milliseconds |
outputLinkValidTill | string | Timestamp indicating when the output link will expire |
Example Payload (A)
To see the request size limits, please refer to the Request Size Limits.
Example Response (A)
To see the main response codes, please refer to the Response Codes page.
Example Payload (B)
To see the request size limits, please refer to the Request Size Limits.
Example Response (B)
To see the main response codes, please refer to the Response Codes page.
Inconsistent URL Encoding in cURL Output: When using cURL to make API requests, the output JSON may show URL characters encoded as Unicode escape sequences. For example, the ampersand character (
&) may appear as \u0026 in the cURL output. This is normal JSON encoding behavior and does not affect the validity of the URL. The URL will function correctly when used, as JSON parsers automatically decode these escape sequences. If you’re parsing the response programmatically, your JSON parser will handle this conversion automatically.Code Samples
- CURL (1)
- CURL (2)
- JavaScript/Node.js
- Python
- C#
- Java
- PHP
Create Fillable PDF Forms
You can create fillable PDF forms by adding editable text boxes and checkboxes. By using the annotations[] attribute and setting the type to textfield or checkbox you can create form elements to be placed on your PDF .Example Payload (Create Fillable PDF Forms)
Example Response (Create Fillable PDF Forms)
CURL
Fill PDF Forms
You can fill existing form fields in a PDF after identifying the form field names. Once form fields are identified then the fields[] attribute should be used to populate the fields by fieldName .Example Payload (Fill PDF Forms)
Example Response (Fill PDF Forms)
CURL
Code samples (For Fill PDF Forms)
- JavaScript/Node.js
- Python
- C#
- Java
- PHP