Create, Fill, or Edit Fillable PDF Forms with C++

Create, Fill, or Edit Fillable PDF Forms with C++

With the advent of computers and the internet, a lot of information is captured digitally. Different companies came up with solutions to make this process more efficient. One such solution is the fillable PDF forms. PDF forms are a popular choice that makes it easy to capture information digitally. PDF forms may be used for capturing survey data or as admission forms. In light of this, this article will teach you how to create, fill and edit fillable PDF forms using C++.

C++ API for Creating, Filling, and Editing Fillable PDF Forms

Aspose.PDF for C++ is a C++ library that allows you to create, read and update PDF documents. Furthermore, the API supports creating, filling, and editing fillable PDF forms. You can either install the API through NuGet or download it directly from the downloads section.

PM> Install-Package Aspose.PDF.Cpp

Create Fillable PDF Forms using C++

In this example, we will create a form from scratch with two text boxes and one radio button. However, one text box is multi-line, and the other is single line. The following are the steps to create a form in a PDF file.

The following sample code shows how to create a form in a PDF file using C++.

Image of the PDF file generated by the sample code
Image of the PDF file generated by the sample code

Fill an Existing Form in a PDF File using C++

In this example, we will use the file generated in the previous example. We will load the file using the Document class and fill its fields. The following are the steps to fill the fields of an existing PDF form.

The following sample code shows how to fill an existing form in a PDF file using C++.

Image of the PDF file generated by the sample code
Image of the PDF file generated by the sample code

Modify the Value of a Form Field in a PDF Form using C++

With Aspose.PDF for C++, we can also modify the value of a previously filled field. In this example, we will use the file generated in the previous example and modify the value of the first TextBoxField. To achieve this, please follow the steps given below.

The following sample code shows how to modify the value of a field in a PDF form using C++.

Image of the PDF file generated by the sample code
Image of the PDF file generated by the sample code

Delete a Form Field from an Existing PDF Form using C++

The API also allows you to delete form fields from existing PDF forms. The following are the steps to delete a form field from a PDF form.

The following sample code shows how to delete a form field from an existing PDF form using C++.

Image of the PDF file generated by the sample code
Image of the PDF file generated by the sample code

Get a Free License

You can try the API without evaluation limitations by requesting a free temporary license.

Conclusion

In this article, you have learned how to create forms in PDF files using C++. Additionally, you have learned how to fill and modify existing fields in PDF forms. You have also seen how to remove a form field from a PDF form using Aspose.PDF for C++ API. The API provides a bunch of additional features for working with PDF files that you can explore in detail by going through the official documentation. If you have questions regarding any aspect of the API, please feel free to reach us at our free support forum.

See Also