Add List Item in C++

Contents
[ ]

Use FormEditor for this task. The examples below retain the original C++ code and API Reference steps.

Add list item

Add New Zealand as a choice in the Country field.

  1. Create FormEditor.
  2. Bind the PDF input with Facade::BindPdf().
  3. Add choice items with FormEditor::AddListItem().
  4. Save the resulting PDF with SaveableFacade::Save().
#include <Aspose.PDF.Cpp/Facades/FormEditor.h>
#include <system/array.h>
#include <system/string.h>

namespace  Facades::Examples::PDF_FormEditor
{
	using namespace System;
	using namespace Aspose::Pdf;
	using namespace Aspose::Pdf::Facades;
	using FormEditor = Aspose::Pdf::Facades::FormEditor;

	void AddListItem(String inputFile, String outputFile)
	{
		auto editor = MakeObject<FormEditor>();

		editor->BindPdf(inputFile);
		editor->AddListItem(u"Country", MakeArray<String>({ u"New Zealand", u"New Zealand" }));
		editor->SaveableFacade::Save(outputFile);
	}
} // namespace Facades::Examples::PDF_FormEditor