Merge PDF Files in C++

Use Aspose.Slides for C++ to combine PDF files in C++ applications.

Merge PDF to PDF in C++

Using Aspose.Slides for C++ , you can merge PDF files by importing them with AddFromPdf and saving the presentation with SaveFormat::Pdf.

C++ code for merging PDF to PDF

auto presentation = MakeObject<Presentation>();

presentation->get_Slides()->RemoveAt(0);
presentation->get_Slides()->AddFromPdf(u"first.pdf");
presentation->get_Slides()->AddFromPdf(u"second.pdf");

presentation->Save(u"merged.pdf", SaveFormat::Pdf);
presentation->Dispose();

Merge PDF to PDF using Aspose.Slides

Aspose.Slides for C++ is a C++ API for working with presentation content and PDF files. You can import multiple PDF files into a Presentation and save the combined result as a single PDF file.

How to merge PDF files in C++

  1. Install Aspose.Slides for C++. See Installation.
  2. Add the library as a reference in your project.
  3. Create a Presentation instance.
  4. Import the source PDF files with AddFromPdf.
  5. Save the merged file with SaveFormat::Pdf.

Built with Aspose.Slides

Merge PDF Files Online

The free Aspose.Slides Merger app is built with Aspose.Slides for C++, the same API as the code above. Open it and see what the API can do with your own PDF files.

  • Runs in your browser, nothing to install.
  • See how Aspose.Slides merges files before you write code.
  • Upload several PDF files and combine them into one.
  • Download the merged result as one file.

Merge other files

You can also combine files in other formats.