# 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
public interface TextBoundsProvider
```

<br />

*** ** * ** ***

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

## Summary

| ### Public methods |
|---|---|
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/RectF.html>` | `https://developer.android.com/reference/androidx/pdf/annotation/TextBoundsProvider#getTextBoundsBetweenPoints(kotlin.Int,android.graphics.PointF,android.graphics.PointF)( int pageNum, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/PointF.html start, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/PointF.html end )` Asynchronously obtains the rectangular bounds of text between two points on a specific page. |

## Public methods

### getTextBoundsBetweenPoints

```
abstract @NonNull List<@NonNull RectF> getTextBoundsBetweenPoints(
    int pageNum,
    @NonNull PointF start,
    @NonNull PointF end
)
```

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 |
|---|---|
| `int pageNum` | The 0-based index of the page to query. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/PointF.html start` | The starting point of the selection in PDF coordinates. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/PointF.html end` | The end point of the selection in PDF coordinates. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull 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 |