Create TextBox Field in C++
Contents
[
Hide
]
Use FormEditor for this task. The examples below retain the original C++ code and API Reference steps.
Create text box field
Add first_name and last_name text fields to page 1 with initial values Alexander and Smith.
- Create FormEditor.
- Bind the PDF input with Facade::BindPdf().
- Create the fields with FormEditor::AddField().
- Save the resulting PDF with SaveableFacade::Save().
#include <Aspose.PDF.Cpp/Facades/FieldType.h>
#include <Aspose.PDF.Cpp/Facades/FormEditor.h>
#include <system/string.h>
namespace Facades::Examples::PDF_FormEditor
{
using namespace System;
using namespace Aspose::Pdf;
using namespace Aspose::Pdf::Facades;
void CreateTextBoxField(String inputFile, String outputFile)
{
auto editor = MakeObject<FormEditor>();
editor->BindPdf(inputFile);
editor->AddField(FieldType::Text, u"first_name", u"Alexander", 1, 50, 570, 150, 590);
editor->AddField(FieldType::Text, u"last_name", u"Smith", 1, 235, 570, 330, 590);
editor->SaveableFacade::Save(outputFile);
}
} // namespace Facades::Examples::PDF_FormEditor