Concatenate Two PDF Files in C++

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

Merge PDF documents

Concatenate firstInputFile and secondInputFile in that order.

  1. Create PdfFileEditor.
  2. Merge the input files with PdfFileEditor::Concatenate().
#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 MergePdfDocuments(String firstInputFile, String secondInputFile, String outputFile)
{
    auto pdfEditor = MakeObject<PdfFileEditor>();
    pdfEditor->Concatenate(MakeArray<String>({firstInputFile, secondInputFile}), outputFile);
}
} // namespace  Facades::Examples::PDF_FileEditor