Method ConvertFilesAsync
ConvertFilesAsync(IEnumerable<string>, OcrEngine, string, PdfSearchableMakerOptions, CancellationToken)
Makes multiple PDF files searchable in sequence, writing each result to the specified output directory. Output files retain the original file names.
public static Task ConvertFilesAsync(IEnumerable<string> inputPaths, OcrEngine ocrEngine, string outputDirectory, PdfSearchableMakerOptions options = null, CancellationToken cancellationToken = default)
Parameters
inputPathsIEnumerable<string>Paths to the source PDF files.
ocrEngineOcrEngineThe OCR engine to use for text recognition.
outputDirectorystringDirectory where searchable PDFs will be written.
optionsPdfSearchableMakerOptionsOptional configuration applied to every file. When
null, Default is used.cancellationTokenCancellationTokenToken to cancel the entire batch.
Returns
- Task
A task representing the asynchronous operation.
Examples
var files = new[] { "scan1.pdf", "scan2.pdf", "scan3.pdf" };
var ocr = new LMKitOcr();
await PdfSearchableMaker.ConvertFilesAsync(
files, ocr, @"C:\output\searchable");
Exceptions
- ArgumentNullException
inputPaths,ocrEngine, oroutputDirectoryisnull.