PNG JPG BMP TIFF PDF
Aspose.PDF  for .NET

Split PDF in .NET SDK

Split Single PDF Pages in C# Cloud API without the use of any software like Adobe PDF.

Get Started

How to Split Single PDF Files Using C# Cloud API

In order to split PDF files we’ll use Aspose.PDF Cloud .NET SDK This Cloud SDK allows you to easily build cloud-based PDF creator, editor & converter apps in C#, ASP.NET, or other .NET languages for various cloud platforms. Open NuGet package manager, search for Aspose.PDF Cloud and install. You may also use the following command from the Package Manager Console.

Command


    PM> Install-Package Aspose.Pdf-Cloud 

Steps for Splitting PDF via Cloud .NET SDK

A basic merging pdfs programmatically with Aspose.PDF Cloud .NET SDK APIs can be done with just few lines of code.

  1. Create a new Configuration object with your Application Secret and Key
  2. Create an object to connect to the Cloud API
  3. Upload your document file
  4. Perform the splitting
  5. Download the result

System Requirements

It is easy to get started with Aspose.PDF Cloud .NET SDK and there is nothing to install. Simply create an account at Aspose for Cloud and get your application information. Once you have the App SID & key, you are ready to give the Aspose.PDF Cloud .NET SDK.

  • .NET Framework 2.0 or later
  • JSON.NET

 

Split Single PDF File using C#


    public static void SplitSinglePages()
    {
        const string localImageFileName = @"C:\Samples\Sample-Document-01.pdf";
        const string storageFileName = "Sample-Document-01.pdf";
        
        // Get your AppSid and AppSecret from https://dashboard.aspose.cloud (free registration required).
        var pdfApi = new PdfApi(AppSecret, AppSid);

        if (pdfApi.GetFilesList("").Value.All(f => f.Name != storageFileName))
        {
            using var file = File.OpenRead(localImageFileName);
            var uploadResult = pdfApi.UploadFile(storageFileName, file);
            Console.WriteLine(uploadResult.Uploaded[0]);
        }

        var response = pdfApi.PostSplitDocument(storageFileName);
        uint index = 1;
        foreach (var fileName in response.Result.Documents.Select(document=>document.Href))
        {
            pdfApi.DownloadFile(fileName)
                .CopyTo(File.OpenWrite($"page{index++}.pdf"));
        }
    }