Method GetText
GetText(CancellationToken)
Extracts and returns the textual content from the attachment.
public string GetText(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA 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
modeTextOutputModeControls how raw lines are grouped and spaced in the output. See TextOutputMode: RawLines (one line per detection), GridAligned (approximate columns/indentation), ParagraphFlow (paragraph grouping).
cancellationTokenCancellationTokenA 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