Table of Contents

Method SetText

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

SetText(string)

Attaches a textual representation to the attachment, replacing any previously extracted text.

public void SetText(string text)

Parameters

text string

The text to associate with this attachment.

Remarks

Useful for supplying OCR results or curated descriptions for image-based attachments. Subsequent calls to GetText(CancellationToken) and GetTextAsync(CancellationToken) will return this text.

SetText(string, int)

Attaches a textual representation to a specific page of the attachment, overriding any previously set text for that page.

public void SetText(string text, int pageIndex)

Parameters

text string

The text to associate with the specified page.

pageIndex int

Zero-based index of the page to set.

Remarks

Useful for supplying OCR results or curated descriptions for specific pages of multi-page attachments. If the page index exceeds the current page count, empty page elements are inserted to fill the gap. Subsequent calls to GetPageText(int, CancellationToken) and GetPageTextAsync(int, CancellationToken) for the specified page will return this text.

Exceptions

ArgumentOutOfRangeException

Thrown when pageIndex is negative.

SetText(PageElement)

Attaches a textual representation to the attachment from a PageElement structure, overriding any previously set text elements.

public void SetText(PageElement pageElement)

Parameters

pageElement PageElement

The page element containing text content to associate with this attachment.

Remarks

The provided element is cloned internally. Subsequent text retrieval returns the attached element's content.

SetText(PageElement, int)

Attaches a textual representation to a specific page of the attachment, overriding any previously set text for that page.

public void SetText(PageElement pageElement, int pageIndex)

Parameters

pageElement PageElement

The page element containing text content to associate with the specified page.

pageIndex int

Zero-based index of the page to set.

Remarks

The provided element is cloned internally. If the page index exceeds the current page element count, empty page elements are inserted to fill the gap. Subsequent text retrieval for the specified page returns the attached element's content.

Exceptions

ArgumentOutOfRangeException

Thrown when pageIndex is negative or exceeds the attachment's page count.