ByteScout PDF SDK - C# - Document - Merge Two Documents - ByteScout

ByteScout PDF SDK – C# – Document – Merge Two Documents

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

ByteScout PDF SDK – C# – Document – Merge Two Documents

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); } } } [/csharp]


  Click here to get your Free Trial version of the SDK

Tutorials:

prev
next