Merge PDF files in C++
Contents
[
Hide
]
Combine related PDF files into one document by appending their page collections.
Merge two PDF documents
- Open both input files as Document objects.
- Append the pages of the second document to the first with PageCollection::Add().
- Save the result with Document::Save().
#include <Aspose.PDF.Cpp/Document.h>
#include <Aspose.PDF.Cpp/PageCollection.h>
using namespace System;
using namespace Aspose::Pdf;
void MergeDocuments(String inputFile1, String inputFile2, String outputFile) {
auto document1 = MakeObject<Document>(inputFile1);
auto document2 = MakeObject<Document>(inputFile2);
document1->get_Pages()->Add(document2->get_Pages());
document1->Save(outputFile);
}