Add Document Action in C++
Contents
[
Hide
]
Use PdfContentEditor for this task. The examples below retain the original C++ code and API Reference steps.
Add document action
Assign an alert script to the document-open additional action.
- Create PdfContentEditor.
- Bind the PDF input with Facade::BindPdf().
- Set the document action with PdfContentEditor::AddDocumentAdditionalAction().
- Save the resulting PDF with PdfContentEditor::
Save().
#include <Aspose.PDF.Cpp/Facades/PdfContentEditor.h>
#include <system/string.h>
namespace Facades::Examples::PDF_ContentEditor
{
using namespace System;
using namespace Aspose::Pdf;
using namespace Aspose::Pdf::Facades;
void AddDocumentAction(String inputFile, String outputFile)
{
auto editor = MakeObject<PdfContentEditor>();
editor->BindPdf(inputFile);
editor->AddDocumentAdditionalAction(PdfContentEditor::DocumentOpen,
u"app.alert('Document opened with PdfContentEditor action');");
editor->Save(outputFile);
}
} // namespace Facades::Examples::PDF_ContentEditor