Fillable PDF Forms via C++

Сreate fillable PDF acroforms. Use Aspose.PDF for C++ to modify PDF files programmatically

How to Fill PDF Forms Using C++ Library

In order to fill PDF Forms (Acroforms) in PDF file, we’ll use Aspose.PDF for C++ API which is a feature-rich, powerful and easy to use document manipulation API for cpp platform. Open NuGet package manager, search for Aspose.PDF and install. You may also use the following command from the Package Manager Console.

How to Fill AcroForm in PDF using C++


You need Aspose.PDF for C++ to try the code in your environment.

  1. Load PDF in an instance of Document class.
  2. Create a field in PDF file.
  3. Add field to the document.
  4. Save modified PDF

Fill AcroForm in PDF - C++

This sample code shows how to Fill PDF forms in PDF using C++

String _dataDir("C:\\Samples\\");

// Open document
auto document = MakeObject<Document>(_dataDir + u"FillFormField.pdf");

// Get a field
auto textBoxField = System::DynamicCast<Aspose::Pdf::Forms::TextBoxField>
    (document->get_Form()->idx_get(u"textbox1"));

// Modify field value
textBoxField->set_Value(u"Value to be filled in the field");

// Save updated document
document->Save(_dataDir + u"FillFormField_out.pdf");