Home

Bytescout.PDF for .NET



Bytescout.PDF library for .NET - extracting pages from PDF and merging with another PDF file

Download Free Trial Buy Now More Information
For HTML2PDF and XML2PDF solution check our PDFDoc Scout ActiveX library instead

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)

PDF generated using pages extracted from source PDF document


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)

Download Free Trial Buy Now More Information
For HTML2PDF and XML2PDF solution check our PDFDoc Scout ActiveX library instead

"Hello, World!" quick start step-by-step tutorials:

Advanced Examples:

"Hello, World!" quick start step-by-step tutorials:

Advanced Examples:
Products  |  Download  |  Purchase  |  Support  |  Contacts  |  Testimonials  |  News |  

ByteScout, 2003-2008. All other company and product names may be trademarks of their respective companies. Privacy Statement