Method ConvertToStreamAsync
ConvertToStreamAsync(Attachment, OcrEngine, Stream, PdfSearchableMakerOptions, CancellationToken)
Makes a PDF attachment searchable asynchronously and writes the result to a stream.
public static Task ConvertToStreamAsync(Attachment source, OcrEngine ocrEngine, Stream outputStream, PdfSearchableMakerOptions options = null, CancellationToken cancellationToken = default)
Parameters
sourceAttachmentThe source PDF attachment.
ocrEngineOcrEngineThe OCR engine to use for text recognition.
outputStreamStreamA writable stream that receives the searchable PDF.
optionsPdfSearchableMakerOptionsOptional configuration. When
null, Default is used.cancellationTokenCancellationTokenToken to cancel the operation.
Returns
- Task
A task representing the asynchronous operation.
Exceptions
- ArgumentNullException
source,ocrEngine, oroutputStreamisnull.
ConvertToStreamAsync(string, OcrEngine, Stream, PdfSearchableMakerOptions, CancellationToken)
Makes a PDF file searchable asynchronously and writes the result to a stream.
public static Task ConvertToStreamAsync(string inputPath, OcrEngine ocrEngine, Stream outputStream, PdfSearchableMakerOptions options = null, CancellationToken cancellationToken = default)
Parameters
inputPathstringPath to the source PDF file.
ocrEngineOcrEngineThe OCR engine to use for text recognition.
outputStreamStreamA writable stream that receives the searchable PDF.
optionsPdfSearchableMakerOptionsOptional configuration. When
null, Default is used.cancellationTokenCancellationTokenToken to cancel the operation.
Returns
- Task
A task representing the asynchronous operation.
Exceptions
- ArgumentNullException
inputPath,ocrEngine, oroutputStreamisnull.- FileNotFoundException
The file specified by
inputPathdoes not exist.