Table of Contents

Class PdfSplitter

Namespace
LMKit.Document.Pdf
Assembly
LM-Kit.NET.dll

Provides methods to physically split a PDF into separate documents by extracting specific page ranges.

public static class PdfSplitter
Inheritance
PdfSplitter
Inherited Members

Examples

Example: Extract pages from a PDF file

using LMKit.Document;

// Extract pages 1 through 3 into a new PDF file
PdfSplitter.ExtractPages("report.pdf", "1-3", "report_pages1-3.pdf");

Remarks

The PdfSplitter class operates on PDF Attachment instances or file paths and produces new Attachment instances or output files containing the extracted pages.

This class complements DocumentSplitting, which uses a vision language model to detect logical document boundaries. After detection, use PdfSplitter to physically extract the detected segments into separate PDF files.

Methods

ExtractPages(Attachment, int[])

Extracts the specified pages from a PDF attachment and returns a new attachment containing only those pages.

ExtractPages(Attachment, string)

Extracts the specified pages from a PDF attachment and returns a new attachment containing only those pages.

ExtractPages(string, int[], string)

Extracts the specified pages from a PDF file and writes the result to an output file.

ExtractPages(string, string, string)

Extracts the specified pages from a PDF file and writes the result to an output file.

Split(Attachment, DocumentSplittingResult)

Splits a PDF attachment into multiple attachments based on the segments detected by DocumentSplitting.

Split(Attachment, IEnumerable<string>)

Splits a PDF attachment into multiple attachments based on the provided page ranges.

SplitToFiles(Attachment, DocumentSplittingResult, string, string)

Splits a PDF attachment into multiple files based on the segments detected by DocumentSplitting.

SplitToFiles(Attachment, IEnumerable<string>, string, string)

Splits a PDF attachment into multiple files based on the provided page ranges.

SplitToFiles(string, IEnumerable<string>, string, string)

Splits a PDF file into multiple files based on the provided page ranges.