Create CheckBox Field in C++
Contents
[
Hide
]
Use FormEditor for this task. The examples below retain the original C++ code and API Reference steps.
Create check box field
Add checkbox1 to page 1 with its name, caption, and rectangle.
- 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 CreateCheckBoxField(String inputFile, String outputFile)
{
auto editor = MakeObject<FormEditor>();
editor->BindPdf(inputFile);
editor->AddField(FieldType::CheckBox, u"checkbox1", u"Check Box 1", 1, 240, 498, 256, 514);
editor->SaveableFacade::Save(outputFile);
}
} // namespace Facades::Examples::PDF_FormEditor