- Home
- Testimonials
- Purchase
- Developer Tools
- Desktop Utilities
- Download
- Support
- Blog
- Company
How to use copy pages from one PDF document into another PDF document using Bytescout.PDF library for .NET applications
How to split and merge PDF documents using Bytescout.PDF library for .NET
In this example Bytescout.PDF library for .NET extracts pages from one PDF document (images.pdf) and merges with another existing document (HelloWorld.pdf) and then saves into "DestinationDocument.PDF" document file.
Download example source code: bytescoutpdf_example_split_and_merge_pdf.zip (600 KB)

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using Bytescout.PDF;
namespace PagesAPI
{
class Program
{
static void Main(string[] args)
{
// Create main PDF Doc Engine
PDFDocEngine engine = new PDFDocEngine("demo", "demo");
// Load Source Document
//Document SourceDocument = engine.AddDocument("Images.pdf");
// Load Destination Document
//Document DestinationDocument = engine.AddDocument("HelloWorld.pdf");
// Create new pages manager
PagesManager manager = new PagesManager(engine, "images.pdf", "HelloWorld.pdf");
// Take each page from source PDF document
for (uint i = 0; i < manager.SourcePageCount; i++)
manager.AddPage(i);
// Copy all selected in connection pages from source to destination PDF Document
manager.Execute();
// Save destination document
//DestinationDocument.Save("DestinationDocument.pdf");
// open generated PDF document in default PDF viewer installed in Windows
Process.Start("DestinationDocument.pdf");
}
}
}
Download example source code: bytescoutpdf_example_split_and_merge_pdf.zip (600 KB)
Filed in:
PDF SDK for .NET
Tutorials:


