How to Merge PDF Files in .NET
Step-by-step guide to merging PDF files into one PDF document using the GroupDocs.Merger.LowCode library for .NET.
Overview
This article explains how to merge several PDF files into one PDF document using the Merge PDF plugin (JoinPdf) from the GroupDocs.Merger.LowCode package for .NET. GroupDocs Document Merger Plugins are lightweight, single-purpose tools that make merging and splitting documents simple and efficient for .NET developers.
About Document Merger Plugins
GroupDocs Document Merger Plugins are built on our enterprise-grade GroupDocs.Merger SDK. These plugins merge, split, and remove pages in PDF, Word (DOCX), and PowerPoint (PPTX) documents, and are designed for cross-platform use on Windows, macOS, and Linux under .NET 6+. Each plugin offers a lightweight, fixed-price solution for one operation on one format (e.g., Merge PDF), making them ideal for developers who need a simple, focused tool.
Prerequisites
- .NET 6.0 or later
- A license file (
GroupDocs.Merger.LowCode.lic). Without a license, the plugin runs in evaluation mode. - Two or more PDF files to merge
Installation
To install the GroupDocs.Merger.LowCode package, run the following command in your terminal:
dotnet add package GroupDocs.Merger.LowCodeCode Example
The following example appends appendix.pdf to source.pdf and saves the merged document to output/merged.pdf:
using GroupDocs.Merger.Domain.Options;using GroupDocs.Merger.LowCode;// Set your licenseLicense.Set("GroupDocs.Merger.LowCode.lic");// Append the documents to the source PDFvar merger = new JoinPdf("source.pdf", new[] { "appendix.pdf" }, new JoinOptions());// Save the merged PDFmerger.Save("output/merged.pdf");open GroupDocs.Merger.Domain.Optionsopen GroupDocs.Merger.LowCode// Set your licenseLicense.Set("GroupDocs.Merger.LowCode.lic")// Append the documents to the source PDFlet merger = JoinPdf("source.pdf", [ "appendix.pdf" ], JoinOptions())// Save the merged PDFmerger.Save("output/merged.pdf")Imports GroupDocs.Merger.Domain.OptionsImports GroupDocs.Merger.LowCode' Set your licenseLicense.Set("GroupDocs.Merger.LowCode.lic")' Append the documents to the source PDFDim merger As New JoinPdf("source.pdf", {"appendix.pdf"}, New JoinOptions())' Save the merged PDFmerger.Save("output/merged.pdf")Output
The merged document output/merged.pdf contains the pages of source.pdf followed by the pages of appendix.pdf. The output folder is created if it doesn’t exist, and an existing file with the same name is overwritten.
Merge More Than Two PDF Files
List the documents to append in the order they should follow the source document:
using GroupDocs.Merger.Domain.Options;using GroupDocs.Merger.LowCode;// Append chapters 2 and 3 to chapter 1var merger = new JoinPdf("chapter-1.pdf", new[] { "chapter-2.pdf", "chapter-3.pdf" }, new JoinOptions());// Save the merged PDFmerger.Save("output/book.pdf");The source document can also be a Stream. For more examples in C#, VB.NET, and F#, see Using JoinPdf to Merge PDF Documents in the documentation.
Licensing
A license is required to use the plugin without evaluation limitations. In evaluation mode, only the first three pages are processed, and an evaluation message is added to every page of the output. Each plugin is licensed separately. You can obtain a free temporary license for testing: