Append Pages to PDF in C++

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

Append pages to PDF

Append page 1 from sampleFile to inputFile.

  1. Create PdfFileEditor.
  2. Append pages with PdfFileEditor::Append().
#include <Aspose.PDF.Cpp/Facades/PdfFileEditor.h>
#include <system/array.h>
#include <system/string.h>

namespace  Facades::Examples::PDF_FileEditor
{
using namespace System;
using namespace Aspose::Pdf;
using namespace Aspose::Pdf::Facades;

void AppendPagesToPdf(String inputFile, String sampleFile, String outputFile)
{
    auto pdfEditor = MakeObject<PdfFileEditor>();
    pdfEditor->Append(inputFile, MakeArray<String>({sampleFile}), 1, 1, outputFile);
}
} // namespace  Facades::Examples::PDF_FileEditor