Split PDF

The Documentize PDF Manager for .NET is a powerful tool that simplifies the process of splitting large PDF documents into smaller, more manageable files. Whether you need to extract individual pages or divide a document into specific sections, this component allows you to achieve it efficiently and with minimal effort.

How to Split PDF

To split a PDF document into individual pages, follow these steps:

  1. Create an instance of SplitOptions to configure the splitting options.
  2. Add the input PDF file using the AddInput method.
  3. Add output files for each split page using the AddOutput method.
  4. Call the Split method of the PdfManager class to split the PDF document.
​
1// Create SplitOptions object to configure the operation
2var options = new SplitOptions();
3// Add input file path
4options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
5// Specify output PDF file paths
6options.AddOutput(new FileData("path_to_result_pdf_file_1.pdf"));
7options.AddOutput(new FileData("path_to_result_pdf_file_2.pdf"));
8// Perform the process
9PdfManager.Split(options);

How to Split PDF using Streams

To split a PDF document using streams, follow these steps:

  1. Prepare input and output streams.
  2. Create an instance of SplitOptions to configure the splitting process.
  3. Add the input PDF stream using the AddInput method.
  4. Specify output PDF streams using the AddOutput method.
  5. Set the CloseOutputStreams property to false if the output streams need to remain open after the operation.
  6. Call the Split method of the PdfManager class to perform the split operation.
​
 1// Prepare input and output streams
 2using var inputStream = File.OpenRead("path_to_your_pdf_file.pdf");
 3using var outputStream1 = new MemoryStream();
 4using var outputStream2 = new MemoryStream();
 5
 6// Create SplitOptions object to configure the operation
 7var options = new SplitOptions();
 8// Add input stream
 9options.AddInput(inputStream);
10// Specify output PDF streams
11options.AddOutput(outputStream1);
12options.AddOutput(outputStream2);
13// Prevent the closing of output streams
14options.CloseOutputStreams = false;
15// Perform the process
16PdfManager.Split(options);

Key Features:

  • Split PDF by Page: Break down a PDF document into individual pages.
  • Custom Split Options: Configure the splitting process based on your requirements.
  • Organized Output: Easily manage the output files for each split page or section.
 English