ByteScout PDF SDK - C# - Merge Two PDF Documents - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

ByteScout PDF SDK – C# – Merge Two PDF Documents

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF SDK – C# – Merge Two PDF Documents

How to merge two PDF documents in C# with ByteScout PDF SDK

Tutorial on how to merge two PDF documents in C#

With this source code sample you may quickly learn how to merge two PDF documents in C#. ByteScout PDF SDK can merge two PDF documents. It can be used from C#. ByteScout PDF SDK is the library for pdf documents generation, modification and updates. Can also generate and fill PDF forms. Provides support for text (fonts, style, size, font family), layers, pdf form fields, vector and raster drawings.

You will save a lot of time on writing and testing code as you may just take the C# code from ByteScout PDF SDK for merge two PDF documents below and use it in your application. This C# sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! Code testing will allow the function to be tested and work properly with your data.

Trial version of ByteScout PDF SDK is available for free. Source code samples are included to help you with your C# app.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Program.cs
      
using System.Diagnostics; using Bytescout.PDF; namespace CopyPagesFromOneDocumentToAnother { class Program { static void Main(string[] args) { // Open first document Document document1 = new Document("document1.pdf"); document1.RegistrationName = "demo"; document1.RegistrationKey = "demo"; // Open second document Document document2 = new Document("document2.pdf"); document2.RegistrationName = "demo"; document2.RegistrationKey = "demo"; // Add pages from document2 to document1 for (int i = 0; i < document2.Pages.Count; ++i) { document1.Pages.Add(document2.Pages[i]); } // Save merged document document1.Save("MergedDocument.pdf"); // Open result document in default associated application (for demo purpose) ProcessStartInfo processStartInfo = new ProcessStartInfo("MergedDocument.pdf"); processStartInfo.UseShellExecute = true; Process.Start(processStartInfo); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF SDK Home Page

Explore ByteScout PDF SDK Documentation

Explore Samples

Sign Up for ByteScout PDF SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF SDK Home Page

Explore ByteScout PDF SDK Documentation

Explore Samples

Sign Up for ByteScout PDF SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next