Table of Contents

Method SplitToFilesAsync

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

SplitToFilesAsync(Attachment, IEnumerable<string>, string, string, CancellationToken)

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

public static Task<List<string>> SplitToFilesAsync(Attachment source, IEnumerable<string> pageRanges, string outputDirectory, string fileNamePrefix = null, CancellationToken cancellationToken = default)

Parameters

source Attachment

The source PDF attachment.

pageRanges IEnumerable<string>

A collection of 1-based page range strings.

outputDirectory string

Directory where the output files will be written.

fileNamePrefix string

Optional prefix for output file names.

cancellationToken CancellationToken

A token that can be used to cancel the operation.

Returns

Task<List<string>>

A task that resolves to the list of full paths for the created files.

SplitToFilesAsync(Attachment, DocumentSplittingResult, string, string, CancellationToken)

Asynchronously splits a PDF attachment into multiple files based on detected DocumentSplittingResult segments.

public static Task<List<string>> SplitToFilesAsync(Attachment source, DocumentSplittingResult splittingResult, string outputDirectory, string fileNamePrefix = null, CancellationToken cancellationToken = default)

Parameters

source Attachment

The source PDF attachment.

splittingResult DocumentSplittingResult

The detected document segments.

outputDirectory string

Directory where the output files will be written.

fileNamePrefix string

Optional prefix for output file names.

cancellationToken CancellationToken

A token that can be used to cancel the operation.

Returns

Task<List<string>>

A task that resolves to the list of full paths for the created files.

SplitToFilesAsync(string, IEnumerable<string>, string, string, CancellationToken)

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

public static Task<List<string>> SplitToFilesAsync(string inputPath, IEnumerable<string> pageRanges, string outputDirectory, string fileNamePrefix = null, CancellationToken cancellationToken = default)

Parameters

inputPath string

Path to the source PDF file.

pageRanges IEnumerable<string>

A collection of 1-based page range strings.

outputDirectory string

Directory where the output files will be written.

fileNamePrefix string

Optional prefix for output file names.

cancellationToken CancellationToken

A token that can be used to cancel the operation.

Returns

Task<List<string>>

A task that resolves to the list of full paths for the created files.

Share