Table of Contents

Method GetText

Namespace
LMKit.Data
Assembly
LM-Kit.NET.dll

GetText(CancellationToken)

Extracts and returns the textual content from the attachment.

public string GetText(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to monitor for cancellation requests. Default: None.

Returns

string

The textual content; empty string if no text is available.

GetText(TextOutputMode, CancellationToken)

Extracts and returns the textual content using the specified layout aggregation mode.

public string GetText(TextOutputMode mode, CancellationToken cancellationToken = default)

Parameters

mode TextOutputMode

Controls how raw lines are grouped and spaced in the output. See TextOutputMode: RawLines (one line per detection), GridAligned (approximate columns/indentation), ParagraphFlow (paragraph grouping).

cancellationToken CancellationToken

A token to observe while performing extraction. If cancellation is requested before extraction completes, an OperationCanceledException is thrown.

Returns

string

The extracted plain-text content formatted according to mode; an empty string if no textual content is available (e.g., images without OCR or unsupported formats).

Remarks

On first call, this method may parse the underlying data and cache page elements; subsequent calls reuse the cache. For image-based attachments without extractable text, consider supplying OCR output via SetText(string) or SetText(PageElement). If you do not need a specific layout mode, use GetText(CancellationToken).

See Also