Fill Text Fields in C++
Contents
[
Hide
]
Use Form for this task. The examples below retain the original C++ code and API Reference steps.
Fill text fields
Fill name, address, and email with the sample contact details.
- Create Form.
- Bind the PDF input with Facade::BindPdf().
- Fill the named fields with Form::FillField().
- Save the resulting PDF with Form::
Save().
#include <Aspose.PDF.Cpp/Facades/Form.h>
#include <system/string.h>
namespace Facades::Examples::PDF_Form
{
using namespace System;
using namespace Aspose::Pdf;
using namespace Aspose::Pdf::Facades;
using Form = Aspose::Pdf::Facades::Form;
void FillTextFields(String inputFile, String outputFile)
{
auto form = MakeObject<Form>();
form->Facade::BindPdf(inputFile);
form->FillField(u"name", String(u"John Doe"));
form->FillField(u"address", String(u"123 Main St, Anytown, USA"));
form->FillField(u"email", String(u"john.doe@example.com"));
form->Save(outputFile);
}
} // namespace Facades::Examples::PDF_Form