Splitting a PDF document is a quite famous use case in file format manipulation. For instance, the finance management system of some organization creates a report containing many salary slips of their employees, then they need to split the PDF file to multiple files and email to the respective department for further processing. Aspose.PDF Cloud API is the perfect solution for PDF file manipulations.
A unique competitive edge for Aspose.PDF Cloud API is that it has been designed keeping in view the user-perspective. Since the skill set of all users is not the same, thus several SDKs are available in different languages including .NET, Java, PHP, Python, Ruby, and other programming languages. This leverages you to focus on what matters the most, because minor details like handling of requests and responses are managed by the SDK. However, in this article, we will be checking out the following use cases using C# language.
- Split whole PDF file into separate PDF files
- Split specific pages of a PDF document
One can also term this feature as cutting PDF documents or PDF cutter feature using C# language. However, before we proceed to splitting PDF files, it is important to note that you can configure several 3rd party Cloud Storages. Let us now upload a sample PDF document to Cloud Storage using following simple code snippet:
After the file is uploaded to Cloud Storage, let us move on to the code that works as PDF cutter or PDF splitter.
Split whole PDF file to multiple files
You may need to split all pages into separate PDF documents. For instance, n number of PDF documents will be generated if the original document contains n Pages. Follow the below steps in order to split a complete PDF file with single API call:
- Upload PDF file to Cloud Storage
- Call PostSplitDocument API while setting necessary parameters
- Output PDF files will be saved in configured cloud storage
Below C# code snippet is a demonstration of how to split whole PDF document to multiple files.
Split Specific Pages of PDF to Separate Files
You can also split specific pages of a PDF document to separate files as per your requirements. Below C# code can be used to process specific pages of the PDF document.
This code snippet creates separate PDF documents for page number 2,3, and 4 because of the values specified in API request. Those output PDF documents will be saved in the respective folder at Cloud Drive.
It elaborates on the simple yet efficient API features of Aspose.PDF Cloud API, where you only need to sign up for free and evaluate robust features with simple API calls.