Merge PDF documents
Append existing PDF documents from files or streams, whole or only a range of their pages. Password protected documents can be appended with their password.
ExpertPdf MergePDF is a royalty free .NET library that combines existing PDF documents and images into a single PDF document. You can integrate it into your C#, VB.NET or ASP.NET application in a few minutes.
Set the page size, orientation and compression level, the title, author and creation date, and protect the merged document with a password and print, copy and assembling rights. A ready to use command line utility is included.
Append PDF documents, images and empty pages, set up the merged document and its security, and save it in memory or in a file.
PDF documents, images and empty pages, appended in any order. One PDF document out.
Append existing PDF documents from files or streams, whole or only a range of their pages. Password protected documents can be appended with their password.
Append images in any format, from a file or as a System.Drawing.Image object. Each element starts on a new page.
Append an empty page between the other elements of the merged document.
Append PDF documents given as byte arrays, whole or a range of their pages, with their password when they are protected.
Insert a document, a page range, an image or an empty page anywhere in the merged document, not only at the end.
Change the order of the merged pages with ReorderPages; bookmarks follow their pages.
Get the merged document as a byte array, write it to a stream, or save it to a file.
The library supports multithreading, so several merges can run from different threads of your application.
Page size, orientation and compression, document information, passwords and rights.
Set the PDF page size (A4, Letter, Legal and the other standard sizes) and the orientation of the new pages, such as the pages created for images.
Set the PDF compression level, from no compression to the best compression.
Set the title, author, subject, keywords and creation date of the merged document.
Password protect the merged document and set its rights to print, copy and assemble.
Save the merged document as PDF/A-1b, 2b, 3b, 3u or PDF/X-1a for archiving and printing.
Add a bookmark for each merged document, titled from its file name or its document title, and keep or drop the bookmarks of the sources.
Print-ready booklets: two pages per landscape sheet in saddle-stitch order, for one-sided or two-sided printing.
For combining documents and images without writing your own application.
Specify the merge elements, PDF files, images and empty pages, in any order with a simple syntax.
The command line sample comes with its full C# and VB.NET source for .NET Framework, and a .NET 10 version.
Create a PDFMerge object, append the elements one by one, then save the merged document. Console and Windows Forms samples in C# and VB.NET ship with the download.
using ExpertPdf.MergePdf; // Page size, orientation and compression of the merged document var options = new PdfDocumentOptions(); options.PdfPageSize = PdfPageSize.A4; options.PdfPageOrientation = PDFPageOrientation.Portrait; options.PdfCompressionLevel = PDFCompressionLevel.Normal; var pdfMerge = new PDFMerge(options); pdfMerge.LicenseKey = "your license key"; // Each element starts on a new page, in the order it is appended pdfMerge.AppendPDFFile(@"C:\Docs\cover.pdf"); pdfMerge.AppendImageFile(@"C:\Docs\photo.jpg"); pdfMerge.AppendEmptyPage(); pdfMerge.AppendPDFFile(@"C:\Docs\contract.pdf"); pdfMerge.SaveMergedPDFToFile(@"C:\Docs\merged.pdf");
Install with dotnet add package ExpertPdf.MergePdf, or reference epmergepdf.dll from the download. The API reference describes every class and method.
Common questions about inputs, output, document settings and security.
System.Drawing.Image objects, and empty pages. Each element starts on a new page of the merged document.InsertPDFFile, InsertPDFStream and InsertPDFBytes insert a document or a range of its pages at any position, InsertImageFile and InsertEmptyPage insert an image or an empty page, and ReorderPages changes the order of the merged pages. Bookmarks follow their pages.BookletOptions.Enabled the merged pages are placed two per landscape sheet in saddle-stitch order, ready to fold, with an optional order for two-sided printing (TwoSided).PdfDocumentOptions.PdfStandardSubset to PDF/A-1b, 2b, 3b, 3u or PDF/X-1a.AppendPDFFile, AppendPDFStream, AppendImageFile, AppendImageObject and AppendEmptyPage in the order the pages should have.AppendPDFFile and AppendPDFStream have overloads that take a zero based start index and a number of pages, and overloads that take the password of a protected source document.RenderMergedPDFDocument returns the merged document as a byte array, SaveMergedPDFToStream writes it to a stream and SaveMergedPDFToFile saves it to a file.SecurityOptions property you set the user and owner passwords and the rights to print, copy and assemble the document.Download the free trial with C# and VB.NET samples and the command line utility. When you are ready, license MergePDF on the pricing page.