Button Fields and Images in C++
Contents
[
Hide
]
Use Form for this task. The examples below retain the original C++ code and API Reference steps.
Add image appearance to button field
Fill the Image1_af_image button image field from an image stream.
- Create Form.
- Bind the PDF input with Facade::BindPdf().
- Set the field image appearance with Form::FillImageField().
- Save the resulting PDF with Form::
Save().
#include <Aspose.PDF.Cpp/Facades/Form.h>
#include <system/io/file.h>
#include <system/io/file_stream.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 AddImageAppearanceToButtonField(String inputFile, String imageFile, String outputFile)
{
auto form = MakeObject<Form>();
auto imageStream = System::IO::File::OpenRead(imageFile);
form->Facade::BindPdf(inputFile);
form->FillImageField(u"Image1_af_image", imageStream);
form->Save(outputFile);
}
} // namespace Facades::Examples::PDF_Form