Method ExtractPagesAsync
ExtractPagesAsync(string, string, string, CancellationToken)
Asynchronously extracts the specified pages from a PDF file and writes the result to an output file.
public static Task ExtractPagesAsync(string inputPath, string pageRange, string outputPath, CancellationToken cancellationToken = default)
Parameters
inputPathstringPath to the source PDF file.
pageRangestringA 1-based page range string (e.g., "1-5, 7, 9-12"). Null, empty, or "*" extracts all pages.
outputPathstringPath where the extracted PDF will be written.
cancellationTokenCancellationTokenA token that can be used to cancel the operation.
Returns
- Task
A task that represents the asynchronous extraction operation.
ExtractPagesAsync(string, int[], string, CancellationToken)
Asynchronously extracts the specified pages from a PDF file and writes the result to an output file.
public static Task ExtractPagesAsync(string inputPath, int[] pageIndexes, string outputPath, CancellationToken cancellationToken = default)
Parameters
inputPathstringPath to the source PDF file.
pageIndexesint[]Zero-based page indexes to extract.
outputPathstringPath where the extracted PDF will be written.
cancellationTokenCancellationTokenA token that can be used to cancel the operation.
Returns
- Task
A task that represents the asynchronous extraction operation.