Table of Contents

Method ConvertToStreamAsync

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

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

source Attachment

The source PDF attachment.

ocrEngine OcrEngine

The OCR engine to use for text recognition.

outputStream Stream

A writable stream that receives the searchable PDF.

options PdfSearchableMakerOptions

Optional configuration. When null, Default is used.

cancellationToken CancellationToken

Token to cancel the operation.

Returns

Task

A task representing the asynchronous operation.

Exceptions

ArgumentNullException

source, ocrEngine, or outputStream is null.

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

inputPath string

Path to the source PDF file.

ocrEngine OcrEngine

The OCR engine to use for text recognition.

outputStream Stream

A writable stream that receives the searchable PDF.

options PdfSearchableMakerOptions

Optional configuration. When null, Default is used.

cancellationToken CancellationToken

Token to cancel the operation.

Returns

Task

A task representing the asynchronous operation.

Exceptions

ArgumentNullException

inputPath, ocrEngine, or outputStream is null.

FileNotFoundException

The file specified by inputPath does not exist.

Share