Splits PDF document by pages

Namespace:  SautinSoft
Assembly:  SautinSoft.PdfVision (in SautinSoft.PdfVision.dll) Version: 5.3.6.5

Syntax

      
 C#  Visual Basic 
public int SplitPDFFileToPDFFolder(
	string SourceFile,
	string OutputPath
)
Public Function SplitPDFFileToPDFFolder ( _
	SourceFile As String, _
	OutputPath As String _
) As Integer

Parameters

SourceFile
String
Path to PDF file which you want to split by pages
OutputPath
String
Path to directory where to store each PDF page as single file after splitting

Return Value

0 - split successfully
1 - error, can't open input file
2 - error, output directory doesn't exist

Remarks



Examples

CopyHow to split PDF document using C#
using System;
using System.IO;
using System.Collections;

namespace Sample
{
    class Test
    {

        static void Main(string[] args)
        {
            // Split PDF document by pages.
            SautinSoft.PdfVision v = new SautinSoft.PdfVision();
            DirectoryInfo outDir = new DirectoryInfo(@"Pages");
            if (!outDir.Exists)
                outDir.Create();

            //v.Serial = "XXXXXXXXXXXXXXX";

            int ret = v.SplitPDFFileToPDFFolder(@"..\..\simple text.pdf", outDir.FullName);

            // 0 - split successfully
            // 1 - error, can't open input file
            // 2 - error, output directory doesn't exist

            if (ret == 0)
            {
                System.Console.WriteLine("Split successfully!");
                System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(outDir.FullName) { UseShellExecute = true });
            }
        }
    }
}
CopyHow to split PDF document using VB.Net
Imports System
Imports System.IO
Imports System.Collections

Namespace Sample
    Friend Class Test

        Shared Sub Main(ByVal args() As String)
            ' Split PDF document by pages.
            Dim v As New SautinSoft.PdfVision()
            Dim outDir As New DirectoryInfo("Pages")
            If Not outDir.Exists Then
                outDir.Create()
            End If

            'v.Serial = "XXXXXXXXXXXXXXX"


            Dim ret As Integer = v.SplitPDFFileToPDFFolder("..\..\simple text.pdf", outDir.FullName)

            ' 0 - split successfully
            ' 1 - error, can't open input file
            ' 2 - error, output directory doesn't exist


            If ret = 0 Then
                System.Console.WriteLine("Split successfully!")
                System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(outDir.FullName) With {.UseShellExecute = True})
            End If
        End Sub
    End Class
End Namespace

See Also