PDF Mosaic: How to split PDF document

Home       Features       Download       License       Tutorial       Version History       Source Code


This sample shows how to split multipage PDF document using PDF Mosaic library.

C# :

using PDFMosaic;
using System;
namespace SplitPDFDocument
  class SplitPDFDocument
    static void Main(string[] args)
      // Open pdf document
      PDFDocument document = new PDFDocument("multipage_document.pdf");
      for(int i = 0; i < document.Pages.Count; ++i)
        // Generate split file name
        string sFileName = "split_" + i.ToString() + ".pdf";
        // Create new pdf document
        PDFDocument splitDocument = new PDFDocument();
        // Save generated document
        splitDocument.Save(sFileName, true);


Visial Basic.NET :

Imports PDFMosaic
Imports System
Module SplitPDFDocument
  Sub Main()
  ' Open pdf document  
  Dim document As New PDFDocument("multipage_document.pdf")
  Dim i As Integer
  For i = 0 To document.Pages.Count-1
    ' Generate split file name
    Dim sFileName As String = "split_" & i.ToString() & ".pdf"
    ' Create new pdf document
    Dim splitDocument As New PDFDocument()
    ' Save generated document
    splitDocument.Save(sFileName, True)
  End Sub
End Module


Home       Features       Download       License       Tutorial       Version History       Source Code