# TextBoundsProvider

Artifact: [androidx.pdf:pdf-viewer](https://developer.android.com/jetpack/androidx/releases/pdf) [View Source](https://cs.android.com/search?q=file:androidx/pdf/annotation/TextBoundsProvider.kt+class:androidx.pdf.annotation.TextBoundsProvider) Added in [1.0.0-beta01](https://developer.android.com/jetpack/androidx/releases/pdf#1.0.0-beta01)

*** ** * ** ***


```
@ExperimentalPdfApi
interface TextBoundsProvider
```

<br />

*** ** * ** ***

A provider interface that abstracts the retrieval of text boundary information.

## Summary

| ### Public functions |
|---|---|
| `suspend https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/android/graphics/RectF.html>` | `https://developer.android.com/reference/kotlin/androidx/pdf/annotation/TextBoundsProvider#getTextBoundsBetweenPoints(kotlin.Int,android.graphics.PointF,android.graphics.PointF)(pageNum: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, start: https://developer.android.com/reference/android/graphics/PointF.html, end: https://developer.android.com/reference/android/graphics/PointF.html)` Asynchronously obtains the rectangular bounds of text between two points on a specific page. |

## Public functions

### getTextBoundsBetweenPoints

```
suspend fun getTextBoundsBetweenPoints(pageNum: Int, start: PointF, end: PointF): List<RectF>
```

Asynchronously obtains the rectangular bounds of text between two points on a specific page.

The returned list contains `https://developer.android.com/reference/android/graphics/RectF.html` objects representing the boundaries of the text characters found in the range. These rectangles should be provided in PDF coordinates to ensure consistency across different zoom levels and transforms.

| Parameters |
|---|---|
| `pageNum: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The 0-based index of the page to query. |
| `start: https://developer.android.com/reference/android/graphics/PointF.html` | The starting point of the selection in PDF coordinates. |
| `end: https://developer.android.com/reference/android/graphics/PointF.html` | The end point of the selection in PDF coordinates. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/android/graphics/RectF.html>` | A list of `https://developer.android.com/reference/android/graphics/RectF.html` representing the visual segments of the selected text. Returns an empty list if no text is found between the specified points. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-exception/index.html` | if a failure occurs during extraction |