New to Telerik Document ProcessingStart a free 30-day trial

Merge PDF Documents

Updated on Jun 3, 2026

RadPdfProcessing supports merging multiple PDF documents into one using the following approaches:

See the PdfProcessing Content Merging, Splitting, and Adding Demo for a live example.

Using the RadFixedDocument.Merge Method

You can merge PDF documents with the Merge method of RadFixedDocument. This method clones the source document and appends it to the current instance of RadFixedDocument:

C#
int timeoutInterval = 100;
string pdfFolderPath = @"..\..\..\Pdf Files";
// Adjust this path to your PDF files directory
string[] pathsCollection = Directory.GetFiles(pdfFolderPath);
RadFixedDocument resultFile = new RadFixedDocument();
PdfFormatProvider pdfFormatProvider = new PdfFormatProvider();

foreach (string path in pathsCollection)
{
    RadFixedDocument document;
    using (Stream stream = File.OpenRead(path))
    {
        document = pdfFormatProvider.Import(stream, TimeSpan.FromSeconds(timeoutInterval));
        resultFile.Merge(document);
    }
} 
string outputFilePath = "merged_by_RadFixedDocument.pdf";
File.Delete(outputFilePath);
using (Stream output = File.OpenWrite(outputFilePath))
{
    pdfFormatProvider.Export(resultFile, output, TimeSpan.FromSeconds(timeoutInterval));
}
Process.Start(new ProcessStartInfo() { FileName = outputFilePath, UseShellExecute = true });

Using the PdfStreamWriter

An alternative approach is to use the PdfStreamWriter to merge pages from different PDF documents:

C#
string pdfFolderPath = @"..\..\..\Pdf Files";
// Adjust this path to your PDF files directory
string[] pathsCollection = Directory.GetFiles(pdfFolderPath);

using (MemoryStream stream = new MemoryStream())
{
    using (PdfStreamWriter fileWriter = new PdfStreamWriter(stream, leaveStreamOpen: true))
    {
        foreach (string path in pathsCollection)
        {
            using (PdfFileSource fileSource = new PdfFileSource(new MemoryStream(File.ReadAllBytes(path))))
            {
                for (int i = 0; i < fileSource.Pages.Length; i++)
                {
                    PdfPageSource sourcePage = fileSource.Pages[i];
                    using (PdfPageStreamWriter resultPage = fileWriter.BeginPage(sourcePage.Size))
                    {
                        resultPage.WriteContent(sourcePage);
                    }
                }
            }
        }
    }


    string outputFilePath = "merged_by_PdfStreamWriter.pdf";
    File.Delete(outputFilePath);
    using (FileStream fileStream = new FileStream(outputFilePath, FileMode.Create, FileAccess.Write))
    {
        stream.WriteTo(fileStream);
    }

    Process.Start(new ProcessStartInfo() { FileName = outputFilePath, UseShellExecute = true });
}

The following SDK example demonstrates this topic: Manipulate Pages SDK Demo.

See Also