public void Split( SplitOptions options )
Parameters
- options
- The split options that define how the PDFDocument should be split and where the output should be saved. Use factory methods on SplitByPageOptions to create valid options.
public void Split( SplitOptions options )
| Exception | Description |
|---|---|
| System.ArgumentNullException | Thrown when options is null. |
| System.NotSupportedException | Thrown when an unsupported split option type is provided. |
| System.ArgumentException | Thrown when options are invalid (missing output or invalid page indices). |
| System.IndexOutOfRangeException | Thrown when page indices exceed the document's Page count. |
File output:
• SplitByPageOptions.ToPath(int, string) - Extracts single Page to file
• SplitByPageOptions.ToPath(int, int, string) - Extracts Page range to file
• SplitByPageOptions.ToPath(string) - Splits all Pages to separate files
Stream output:
• SplitByPageOptions.ToStream(int, Stream) - Extracts single Page to stream
• SplitByPageOptions.ToStream(int, int, Stream) - Extracts Page range to stream
• SplitByPageOptions.ToStreams(IList<Stream>) - Splits all Pages to individual streams
// Extracts a single Page to file document.Split(SplitByPageOptions.ToPath(2, "page3.pdf")); // Extracts Page range to file document.Split(SplitByPageOptions.ToPath(0, 4, "pages1-5.pdf")); // Splits all Pages into separate files document.Split(SplitByPageOptions.ToPath("output/document.pdf")); // Extracts a single Page to stream var stream = new MemoryStream(); document.Split(SplitByPageOptions.ToStream(2, stream)); // Splits all Pages to individual streams var streams = new List<Stream> { new MemoryStream(), new MemoryStream() }; document.Split(SplitByPageOptions.ToStreams(streams));
.NET: net5.0, net5.0-windows, net6.0, net6.0-macos, net6.0-windows, net7.0, net7.0-macos, net7.0-windows, net8.0, net8.0-browser, net8.0-macos, net8.0-windows, net9.0, net9.0-browser, net9.0-macos, net9.0-windows, net10.0, net10.0-browser, net10.0-macos, net10.0-windows.
.NET Framework: net40, net403, net45, net451, net452, net46, net461, net462, net463, net47, net471, net472, net48, net481.