Table of Contents

Method ConvertAsync

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

ConvertAsync(Attachment, OcrEngine, PdfSearchableMakerOptions, CancellationToken)

Makes a PDF attachment searchable asynchronously by adding invisible text overlays. The output contains the same number of pages as the input.

public static Task<Attachment> ConvertAsync(Attachment source, OcrEngine ocrEngine, PdfSearchableMakerOptions options = null, CancellationToken cancellationToken = default)

Parameters

source Attachment

The source PDF attachment.

ocrEngine OcrEngine

The OCR engine to use for text recognition.

options PdfSearchableMakerOptions

Optional configuration controlling text detection, page range, parallelism, progress reporting, and save behavior. When null, Default is used.

cancellationToken CancellationToken

Token to cancel the operation.

Returns

Task<Attachment>

A new Attachment containing the searchable PDF.

Exceptions

ArgumentNullException

source or ocrEngine is null.

ConvertAsync(string, OcrEngine, PdfSearchableMakerOptions, CancellationToken)

Makes a PDF file searchable asynchronously and returns the result as an attachment.

public static Task<Attachment> ConvertAsync(string inputPath, OcrEngine ocrEngine, 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.

options PdfSearchableMakerOptions

Optional configuration. When null, Default is used.

cancellationToken CancellationToken

Token to cancel the operation.

Returns

Task<Attachment>

A new Attachment containing the searchable PDF.

Exceptions

ArgumentNullException

inputPath or ocrEngine is null.

FileNotFoundException

The file specified by inputPath does not exist.

Share