Skip to main content

Complete Forms


Complete a PDF with form fields programmatically and save the PDF as a new completed PDF document.

The DynamicPDF API makes completing forms programmatically a breeze.

tip

Check out Getting Started and Task Roadmap if you are new to The DynamicPDF API.

info

You can also flatten the form fields in a PDF, remove form fields, and retain signature fields. Refer to the following documentation topic for more information on forms (pdf instructions - form fields).

The following examples illustrate.

Calling Endpoint Directly

Create a JSON instructions document and call it from the pdf endpoint directly.

  • Define an input of type pdf containing the form to complete.
  • Create a formfields array and add each field name and desired value to the array.
{
"author": "John Doe",
"title": "My PDF From REST API",
"inputs": [
{
"type": "pdf",
"resourceName": "simple-form-fill.pdf"
}
],
"formFields": [
{
"name": "nameField",
"value": "DynamicPDF"
},
{
"name": "descriptionField",
"value": "DynamicPDF CloudAPI. RealTime PDFs, Real FAST!"
}
]
}

Run In Postman

curl --location 'https://api.dpdf.io/v1.0/pdf'
--header 'Authorization: Bearer DP--api-key--'
--form 'Instructions=@C:/temp/solutions/forms/instructions.json'
--form 'Resource=@C:/temp/solutions/forms/simple-form-fill.pdf'

Calling Endpoint Using Client Library

Complete a form by calling the pdf programmatically using one of the DynamicPDF API's client libraries.

public static Pdf FormFieldsExample(String basePath) {
Pdf pdf = new Pdf();
pdf.AddPdf(new PdfResource(basePath + "simple-form-fill.pdf"));
FormField formField = new FormField("nameField", "DynamicPdf");
FormField formField2 = new FormField("descriptionField", "RealTime Pdf's. Real FAST!");
pdf.FormFields.Add(formField);
pdf.FormFields.Add(formField2);
return pdf;
}
Source: InstructionsExample.cs
info

The pdf endpoint takes a JSON instructions document that provides instructions for creating, transforming, merging, and formatting inputs into a combined PDF. Refer to documentation on the instructions schema for information on how to use the pdf endpoint.

   Follow us on social media for latest news!