Test in a live environment
Test in production without watermarks.
Works wherever you need it to.
In the modern digital age, PDF files have become one of the most popular document formats. Whether it's a business report, an academic paper, or an eBook, PDFs offer a reliable and versatile platform to share information. However, sometimes you may have multiple PDF files that you want to merge into one document.
Adobe Acrobat Reader is considered to be the industry standard for combining PDF files, but it’s not always accessible or straightforward to use. In this guide, we’ll explain how to merge PDF files using our feature-rich C# library, IronPDF, as well as recommend a couple of free online tools which offer basic functionality.
IronPDF is a lightweight .NET PDF library designed specifically with web developers in mind. PDF conversion is just one of many uses - it makes reading, writing, and manipulating PDFs a breeze, and you can use it in your .NET projects for both desktop and web. The best part - it’s free to try out in a development environment.
One of the main advantages of IronPDF is its flexibility. It can be used as a standalone desktop application or integrated into your web application using the IronPDF API. Additionally, IronPDF is compatible with both Windows and Mac operating systems, making it accessible to a wide range of users.
First of all, open Visual Studio and go to File -> New Project -> Console Application. Enter your project name, choose the location you want to save it to, and hit the Next button. Select the latest .NET Framework and then Create. Once your project is up and running, it’s time to add our library.
IronPDF is easy to use but it’s even easier to install. There are a couple of ways you can do it:
In Visual Studio, in Solution Explorer, right-click References, and then click Manage NuGet Packages. Hit browse and search ‘IronPDF, and install the latest version. If you see this, it’s working:
You can also go to Tools -> NuGet Package Manager -> Packet Manager Console, and enter the following line in the Package Manager Tab:
Install-Package IronPdf
Finally, you can get IronPDF directly from NuGet’s official website. Select the Download Package option from the menu on the right of the page, double-click your download to install it automatically, and reload the Solution to start using it in your project.
Didn’t work? You can find platform-specific help on our advanced NuGet installation page.
You can also get the IronPDF DLL file straight from us and add it to Visual Studio manually. For full instructions and links to the Windows, MacOS, and Linux DLL packages, check out our dedicated installation page.
Always remember to kick off your code with the IronPDF namespace, like this:
using IronPdf;
using IronPdf;
Imports IronPdf
Now that we have our project and added IronPDF, it’s time to combine our PDF files.
The first step is loading the PDF documents we want to merge. You can do this using the PdfDocument.FromFile method. In the following example, we are loading two PDF files named A.pdf and B.pdf:
var firstPDF = PdfDocument.FromFile("A.pdf");
var secondPDF = PdfDocument.FromFile("B.pdf");
var firstPDF = PdfDocument.FromFile("A.pdf");
var secondPDF = PdfDocument.FromFile("B.pdf");
Dim firstPDF = PdfDocument.FromFile("A.pdf")
Dim secondPDF = PdfDocument.FromFile("B.pdf")
Once you have loaded the PDF files, you can use the PdfDocument.Merge method to merge them into a single PDF file. In the following example, we are merging the "firstPDF" and "secondPDF" files:
var merged = PdfDocument.Merge(firstPDF, secondPDF);
var merged = PdfDocument.Merge(firstPDF, secondPDF);
Dim merged = PdfDocument.Merge(firstPDF, secondPDF)
Finally, you need to save the merged PDF file to your computer. You can do this using the SaveAs method. In the following example, we are saving the merged PDF file as "Merged.pdf":
merged.SaveAs("Merged.pdf");
merged.SaveAs("Merged.pdf");
merged.SaveAs("Merged.pdf")
The complete code to merge two PDF files using IronPDF is as follows:
using IronPdf;
var firstPDF = PdfDocument.FromFile("A.pdf");
var secondPDF = PdfDocument.FromFile("B.pdf");
var merged = PdfDocument.Merge(firstPDF, secondPDF);
merged.SaveAs("Merged.pdf");
using IronPdf;
var firstPDF = PdfDocument.FromFile("A.pdf");
var secondPDF = PdfDocument.FromFile("B.pdf");
var merged = PdfDocument.Merge(firstPDF, secondPDF);
merged.SaveAs("Merged.pdf");
Imports IronPdf
Private firstPDF = PdfDocument.FromFile("A.pdf")
Private secondPDF = PdfDocument.FromFile("B.pdf")
Private merged = PdfDocument.Merge(firstPDF, secondPDF)
merged.SaveAs("Merged.pdf")
By following these steps and using the IronPDF library, you can easily merge multiple PDF files into a single document using IronPDF.
There are tools which allow you to merge PDF files online. They can be convenient, but don’t offer the same flexibility or security as a dedicated PDF library such as IronPDF.
PDFSam Basic is a lightweight and user-friendly PDF editor that enables you to combine, split, and manipulate PDF files. It offers a range of basic features that are easy to use, making it a good option for those who are new to PDF editing.
SmallPDF is a popular online tool that offers a range of PDF editing features, including the ability to combine multiple PDF files. One of the main advantages of SmallPDF is its convenience. Because it is a web-based tool, you can access it from any device with an internet connection, without needing to download or install any software.
And that’s how you combine PDF files without using Adobe Acrobat. PDFSam Basic and SmallPDF are easy to use and offer a range of basic editing features. However, for a more powerful solution to PDF editing, IronPDF offers flexibility which cannot be matched.
And merging PDFs is just the start - with HTML to PDF conversion, PDF formatting tools, built-in security and compliance features, and more, IronPDF is the number one tool for all of your PDF document needs.
Ready to get your hands on IronPDF? You can start with our 30-day free trial. It’s also completely free to use for development purposes so you can really get to see what it’s made of. And if you like what you see, IronPDF starts as low as $749. For even bigger savings, check out the Iron Suite where you can get all nine Iron Software tools for the price of two. Happy coding!
9 .NET API products for your office documents