TextRange

data class TextRange(val pageIndex: Int, val start: Int, val length: Int, val textBlocks: List<Rect>)

Represents a range of text within a document page.

This class holds the data required to identify and display a text selection or search result on a document page. Can be used as UI state.

Constructors

Link copied to clipboard
constructor(pageIndex: Int, start: Int, length: Int, textBlocks: List<Rect>)

Properties

Link copied to clipboard
val end: Int

The ending character index (exclusive) of the text range.

Link copied to clipboard

Returns true if this text range contains no characters or has no visual bounds.

Link copied to clipboard
val length: Int

The number of characters in the text range.

Link copied to clipboard

The zero-based index of the page containing this text range.

Link copied to clipboard
val start: Int

The starting character index of the text range within the page.

Link copied to clipboard

The list of rectangles representing the visual bounds of the text blocks.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

We don't need to compare the textBlocks. pageIndex, start and length are enough to determine equality.

Link copied to clipboard
open override fun hashCode(): Int

Returns a hash code based on pageIndex, start, and length.