 |
PdfSplitManager Class |
Splits an existing PDF document: extracts pages into a new document, or divides it into several documents by
page count, at its top level bookmarks or by file size.
Inheritance HierarchySystemObject
SelectPdf.UniversalPdfSplitManager
Namespace: SelectPdf.UniversalAssembly: SelectPdf.Universal (in SelectPdf.Universal.dll) Version: 26.6
Syntaxpublic class PdfSplitManager : IDisposable
Public Class PdfSplitManager
Implements IDisposable
The PdfSplitManager type exposes the following members.
Constructors
Methods| | Name | Description |
|---|
 | Close | Releases the loaded document. |
 | Dispose | Releases the loaded document; the same as Close. |
 | ExtractEvenPages | Extracts the even pages (the second, fourth, ...) into a new document. |
 | ExtractOddPages | Extracts the odd pages (the first, third, fifth, ...) into a new document. |
 | ExtractPages | Extracts pages into a new document, in the order given. |
 | Load(Byte) | Loads a PDF document from a byte array. |
 | Load(PdfDocument) | Loads an existing PdfDocument. |
 | Load(Stream) | Loads a PDF document from a stream. |
 | Load(String) | Loads a PDF document from a file. |
 | Load(Byte, String) | Loads a password-protected PDF document from a byte array. |
 | Load(PdfDocument, String) | Loads an existing PdfDocument with a password. |
 | Load(Stream, String) | Loads a password-protected PDF document from a stream. |
 | Load(String, String) | Loads a password-protected PDF document from a file. |
 | Split | Divides the document into documents of at most pagesPerDocument pages each. |
 | SplitByBookmarks |
Divides the document at its top level bookmarks: one document per bookmark, from the page it opens to the
page before the next one, titled with the bookmark's text.
|
 | SplitBySize |
Divides the document into documents of at most maxFileSize bytes each, every one holding as
many pages as fit.
|
Top
Remarks
Load a document with one of the
Load overloads, then call the operations - each returns new
PdfDocument objects, which can be changed further and must be saved and closed by the caller.
The source document is not modified. Each extracted document keeps the source's document information, and the
bookmarks and form fields of its pages; the logical structure and a PDF/A or PDF/UA claim are not carried.
ExamplePdfSplitManager splitter = new PdfSplitManager();
splitter.Load("document.pdf");
PdfDocument summary = splitter.ExtractPages("1,3-5");
summary.Save("summary.pdf");
summary.Close();
PdfDocument[] parts = splitter.Split(10);
for (int i = 0; i < parts.Length; i++)
{
parts[i].Save("part-" + (i + 1) + ".pdf");
parts[i].Close();
}
splitter.Close();Dim splitter As New PdfSplitManager()
splitter.Load("document.pdf")
Dim summary As PdfDocument = splitter.ExtractPages("1,3-5")
summary.Save("summary.pdf")
summary.Close()
Dim parts As PdfDocument() = splitter.Split(10)
For i As Integer = 0 To parts.Length - 1
parts(i).Save("part-" & (i + 1) & ".pdf")
parts(i).Close()
Next
splitter.Close()
See Also