# OcrText

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

*** ** * ** ***


```
@ExperimentalPdfApi
public final class OcrText
```

<br />

*** ** * ** ***

Represents a segment of recognized text and its visual mapping in an image.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/pdf/ocr/OcrText#OcrText(kotlin.String,kotlin.collections.List)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html text, @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/Rect.html> bounds)` |

| ### Public methods |
|---|---|
| `final @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/Rect.html>` | `https://developer.android.com/reference/androidx/pdf/ocr/OcrText#getBounds()()` A list of `https://developer.android.com/reference/android/graphics/Rect.html` objects representing the visual bounding boxes of the text. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/pdf/ocr/OcrText#getText()()` The recognized string content. |

## Public constructors

### OcrText

Added in [1.0.0-beta01](https://developer.android.com/jetpack/androidx/releases/pdf#1.0.0-beta01)

```
public OcrText(@NonNull String text, @NonNull List<@NonNull Rect> bounds)
```

## Public methods

### getBounds

Added in [1.0.0-beta01](https://developer.android.com/jetpack/androidx/releases/pdf#1.0.0-beta01)

```
public final @NonNull List<@NonNull Rect> getBounds()
```

A list of `https://developer.android.com/reference/android/graphics/Rect.html` objects representing the visual bounding boxes of the text. The bounds are typically aggregated by line to optimize for rendering and selection.

### getText

Added in [1.0.0-beta01](https://developer.android.com/jetpack/androidx/releases/pdf#1.0.0-beta01)

```
public final @NonNull String getText()
```

The recognized string content.