We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to merge PDF documents with grouped bookmarks in C# and VB.NET

Platform: WinForms |
Control: PDF

The Syncfusion Essential PDF is a feature-rich and high performance .NET PDF library used to create, read, and edit PDF documents programmatically without Adobe dependencies. This library also offers functionality to merge, split, stamp, forms, compress, and secure PDF files.

This sample uses the following PDF documents and explains how to merge them with grouped bookmarks using Syncfusion .NET PDF library.

PDF document with bookmarks

PDF document with bookmarks

Steps to merge PDF documents with grouped bookmarks programmatically in C#:

  1. Create a new C# console application project. Create a console application in Visual Studio
  2. Install the Syncfusion.Pdf.WinForms NuGet package as a reference to your .NET Framework application from the NuGet.orgRefer NuGet package to the project
  3. You can merge two PDF documents by using the Merge method of PdfDocumentBase class.


//Merge PDF file
PdfDocumentBase.Merge(document, loadedDocument);



'Merge PDF file
PdfDocumentBase.Merge(document, loadedDocument)


  1. Include the following namespaces in Program.cs file.


using Syncfusion.Pdf;



Imports Syncfusion.Pdf


  1. Include the following code snippet in main method of Program.cs file to merge PDF documents with grouped bookmarks.


//Create a new PDF document
PdfDocument finalDoc = new PdfDocument();
//Create a string array of source files to be merged
string[] source = { "Document1.pdf", "Document2.pdf" };
//Merge the PDF documents
PdfDocument.Merge(finalDoc, source);
//Save the PDF document
//Close the instance of PdfDocument



'Create a new PDF document
Dim finalDoc As PdfDocument = New PdfDocument
'Create a string array of source files to be merged
Dim source() As String = {"Document1.pdf", "Document2.pdf"}
'Merge the PDF documents
PdfDocument.Merge(finalDoc, source)
'Save the PDF document
'Close the instance of PdfDocument


A complete work sample to merge PDF documents with grouped bookmarks can be downloaded from MergePDF.zip.

By executing the program, you will get the PDF document as follows.

Merged PDF document with grouped bookmarks

Take a moment to peruse the documentation, where you will find other options like RTF to PDF conversion, XPS to PDF conversion, PDF to image conversion, HTML to MHTML, HTML to SVG, partial webpage to SVG, and more.

Click here to explore the rich set of Syncfusion Essential PDF features.

An online sample link to convert Word document to PDF, RTF to PDF, XPS to PDF, TIFF to PDF, PDF to Image, and Excel document to PDF.

See Also:

Merge all PDF files in a folder into single PDF document


Starting with v16.2.0.x, if you reference Syncfusion assemblies from trial setup or from the NuGet feed, include a license key in your projects. Refer to link to learn about generating and registering Syncfusion license key in your application to use the components without trail message.


2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile