DocumentTextProvider

Interface for providing text data of a PDF document.

Types

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

Functions

Link copied to clipboard
abstract fun getCharIndexAt(@IntRange(from = 0) pageIndex: Int, x: Float, y: Float): Int

Return the index of the closest character whose rect intersects the given x and y coordinates.

Link copied to clipboard

abstract fun getPageText(@IntRange(from = 0) pageIndex: Int): String

Returns text content of the document page.

abstract fun getPageText(@IntRange(from = 0) pageIndex: Int, rect: RectF): String

Returns text content inside given page rectangle.

abstract fun getPageText(@IntRange(from = 0) pageIndex: Int, start: Int, length: Int): String

Returns text content between two character indexes. Use getPageTextLength to determine the number of characters on page.

Link copied to clipboard
abstract fun getPageTextLength(@IntRange(from = 0) pageIndex: Int): Int

Gets number of characters in text on the page.

Link copied to clipboard
abstract fun getPageTextRects(@IntRange(from = 0) pageIndex: Int, startIndex: Int, length: Int, markupPadding: Boolean = true): List<Rect>

Returns the rects of the range of characters on a page.

Link copied to clipboard
abstract fun getWordAtPoint(pageIndex: Int, x: Float, y: Float, tolerance: Float, markupPadding: Boolean = true): DocumentTextProvider.TextRange?

Looks for a word at the given point.