# PdfRenderer.Page

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Page

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/graphics/pdf/PdfRenderer.Page "View this page in Java")  

```
class Page : AutoCloseable
```

|---|--------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                 ||
| ↳ | [android.graphics.pdf.PdfRenderer.Page](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#) |

This class represents a PDF document page for rendering.

## Summary

|                                                                                                                                        Constants                                                                                                                                         ||
|----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [RENDER_MODE_FOR_DISPLAY](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#RENDER_MODE_FOR_DISPLAY:kotlin.Int) Mode to render the content for display on a screen. |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [RENDER_MODE_FOR_PRINT](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#RENDER_MODE_FOR_PRINT:kotlin.Int) Mode to render the content for printing.                |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Public methods                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                                                                                                                                                                                                                                                                                              | [addPageAnnotation](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#addPageAnnotation(android.graphics.pdf.component.PdfAnnotation))`(`annotation:` `[PdfAnnotation](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfAnnotation)`)` Adds the given annotation to the page.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                                                                                                                                                                                                                                                                                              | [addPageObject](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#addPageObject(android.graphics.pdf.component.PdfPageObject))`(`pageObject:` `[PdfPageObject](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfPageObject)`)` Adds the given[PdfPageObject](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfPageObject)to the page.                                                                                                                                                                                                                                                                                                                                                                                                                     |
| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#)!\>                                                                                                                                                                                          | [applyEdit](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#applyEdit(android.graphics.pdf.models.FormEditRecord))`(`editRecord:` `[FormEditRecord](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormEditRecord)`)` Applies a[FormEditRecord](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormEditRecord)to the PDF.                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                                                                                                                                                                                            | [close](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#close())`()` Closes this page.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| [FormWidgetInfo](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo)                                                                                                                                                                                                                                                                             | [getFormWidgetInfoAtIndex](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#getFormWidgetInfoAtIndex(kotlin.Int))`(`widgetIndex:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Returns information about the widget with`widgetIndex`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [FormWidgetInfo](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo)                                                                                                                                                                                                                                                                             | [getFormWidgetInfoAtPosition](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#getFormWidgetInfoAtPosition(kotlin.Int,%20kotlin.Int))`(`x:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `y:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Returns information about the widget at the given point.                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[FormWidgetInfo](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo)!\>                                                                                                                                                                 | [getFormWidgetInfos](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#getFormWidgetInfos())`()` Returns information about all form widgets on the page, or an empty list if there are no form widgets on the page.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[FormWidgetInfo](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo)!\>                                                                                                                                                                 | [getFormWidgetInfos](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#getFormWidgetInfos(kotlin.IntArray))`(`types:` `[IntArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int-array/index.html)`)` Returns information about all form widgets of the specified types on the page, or an empty list if there are no form widgets of the specified types on the page.                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[PdfPageGotoLinkContent](https://developer.android.com/reference/kotlin/android/graphics/pdf/content/PdfPageGotoLinkContent)!\>                                                                                                                                                | [getGotoLinks](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#getGotoLinks())`()` Gets bookmarks and goto links present on the page of a pdf document.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                                                                                                                                                                                                                                                                                              | [getHeight](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#getHeight())`()` Returns the height of the[PdfRenderer.Page](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#)object in points (1/72").                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[PdfPageImageContent](https://developer.android.com/reference/kotlin/android/graphics/pdf/content/PdfPageImageContent)!\>                                                                                                                                                      | [getImageContents](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#getImageContents())`()` Return list of[PdfPageImageContent](https://developer.android.com/reference/kotlin/android/graphics/pdf/content/PdfPageImageContent)found on the page, ordered left to right and top to bottom.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                                                                                                                                                                                                                                                                                              | [getIndex](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#getIndex())`()` Gets the page index.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[PdfPageLinkContent](https://developer.android.com/reference/kotlin/android/graphics/pdf/content/PdfPageLinkContent)!\>                                                                                                                                                        | [getLinkContents](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#getLinkContents())`()` Get the bounds and URLs of all the links on the page.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[Pair](https://developer.android.com/reference/kotlin/android/util/Pair.html#)\<[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!,[PdfAnnotation](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfAnnotation)!\>!\> | [getPageAnnotations](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#getPageAnnotations())`()` Returns a list of pairs, where each pair consists of a supported[PdfAnnotation](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfAnnotation)and its corresponding ID on the specified page.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[Pair](https://developer.android.com/reference/kotlin/android/util/Pair.html#)\<[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!,[PdfPageObject](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfPageObject)!\>!\> | [getPageObjects](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#getPageObjects())`()` Returns[List](https://developer.android.com/reference/kotlin/java/util/List.html#)of[Pair](https://developer.android.com/reference/kotlin/android/util/Pair.html#)objects, where each pair contains: - An[Integer](https://developer.android.com/reference/kotlin/java/lang/Integer.html#)representing the object ID, which is required for[updatePageObject(int,android.graphics.pdf.component.PdfPageObject)](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#updatePageObject(kotlin.Int,%20android.graphics.pdf.component.PdfPageObject))and[removePageObject(int)](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#removePageObject(kotlin.Int)). |
| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[PdfPageTextContent](https://developer.android.com/reference/kotlin/android/graphics/pdf/content/PdfPageTextContent)!\>                                                                                                                                                        | [getTextContents](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#getTextContents())`()` Return list of[PdfPageTextContent](https://developer.android.com/reference/kotlin/android/graphics/pdf/content/PdfPageTextContent)found on the page, ordered left to right and top to bottom.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| [Pair](https://developer.android.com/reference/kotlin/android/util/Pair.html#)\<[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!,[PdfPageObject](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfPageObject)!\>?                                                                                                            | [getTopPageObjectAtPosition](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#getTopPageObjectAtPosition(android.graphics.PointF,%20kotlin.IntArray))`(`point:` `[PointF](https://developer.android.com/reference/kotlin/android/graphics/PointF.html#)`, `types:` `[IntArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int-array/index.html)`)` Retrieves the top-most page object at a specified position.                                                                                                                                                                                                                                                                                                                                                                                                 |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                                                                                                                                                                                                                                                                                              | [getWidth](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#getWidth())`()` Returns the width of the[PdfRenderer.Page](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#)object in points (1/72").                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                                                                                                                                                                                            | [removePageAnnotation](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#removePageAnnotation(kotlin.Int))`(`annotationId:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Removes the annotation with the specified id.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                                                                                                                                                                                            | [removePageObject](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#removePageObject(kotlin.Int))`(`objectId:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Removes the[PdfPageObject](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfPageObject)with the specified ID.                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                                                                                                                                                                                            | [render](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#render(android.graphics.Bitmap,%20android.graphics.Rect,%20android.graphics.Matrix,%20android.graphics.pdf.RenderParams))`(`destination:` `[Bitmap](https://developer.android.com/reference/kotlin/android/graphics/Bitmap.html#)`, `destClip:` `[Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#)?`, `transform:` `[Matrix](https://developer.android.com/reference/kotlin/android/graphics/Matrix.html#)?`, `params:` `[RenderParams](https://developer.android.com/reference/kotlin/android/graphics/pdf/RenderParams)`)` Renders a page to a bitmap.                                                                                                                                                                      |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                                                                                                                                                                                            | [render](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#render(android.graphics.Bitmap,%20android.graphics.Rect,%20android.graphics.Matrix,%20kotlin.Int))`(`destination:` `[Bitmap](https://developer.android.com/reference/kotlin/android/graphics/Bitmap.html#)`, `destClip:` `[Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#)?`, `transform:` `[Matrix](https://developer.android.com/reference/kotlin/android/graphics/Matrix.html#)?`, `renderMode:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Renders a page to a bitmap.                                                                                                                                                                                                               |
| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[PageMatchBounds](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/PageMatchBounds)!\>                                                                                                                                                               | [searchText](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#searchText(kotlin.String))`(`query:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Search for the given string on the page and returns the bounds of all the matches.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| [PageSelection](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/selection/PageSelection)?                                                                                                                                                                                                                                                                    | [selectContent](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#selectContent(android.graphics.pdf.models.selection.SelectionBoundary,%20android.graphics.pdf.models.selection.SelectionBoundary))`(`start:` `[SelectionBoundary](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/selection/SelectionBoundary)`, `stop:` `[SelectionBoundary](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/selection/SelectionBoundary)`)` Return a[PageSelection](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/selection/PageSelection)which represents the selected content that spans between the two boundaries.                                                                                                                             |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                                                                                                                                                                                                                                                                      | [updatePageAnnotation](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#updatePageAnnotation(kotlin.Int,%20android.graphics.pdf.component.PdfAnnotation))`(`annotationId:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `annotation:` `[PdfAnnotation](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfAnnotation)`)` Update the given[PdfAnnotation](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfAnnotation)to the page.                                                                                                                                                                                                                                                                                         |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                                                                                                                                                                                                                                                                      | [updatePageObject](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#updatePageObject(kotlin.Int,%20android.graphics.pdf.component.PdfPageObject))`(`objectId:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `pageObject:` `[PdfPageObject](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfPageObject)`)` Update the given[PdfPageObject](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfPageObject)to the page.                                                                                                                                                                                                                                                                                                     |

|                                                                                          Protected methods                                                                                           ||
|------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [finalize](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#finalize())`()` <br /> |

## Constants

### RENDER_MODE_FOR_DISPLAY

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val RENDER_MODE_FOR_DISPLAY: Int
```

Mode to render the content for display on a screen.  

    Value: 1

### RENDER_MODE_FOR_PRINT

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val RENDER_MODE_FOR_PRINT: Int
```

Mode to render the content for printing.  

    Value: 2

## Public methods

### addPageAnnotation

Added in[API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun addPageAnnotation(annotation: PdfAnnotation): Int
```

Adds the given annotation to the page. The annotation should be of supported type. See[PdfAnnotationType](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfAnnotationType)for the supported types

[PdfRenderer.write](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer#write(android.os.ParcelFileDescriptor,%20kotlin.Boolean))needs to be called to get the updated PDF stream after calling this method.[PdfRenderer.Page](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#)instance can be closed before calling[PdfRenderer.write](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer#write(android.os.ParcelFileDescriptor,%20kotlin.Boolean)).

|                                                                                                                                     Parameters                                                                                                                                      ||
|--------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `annotation` | [PdfAnnotation](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfAnnotation):the[PdfAnnotation](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfAnnotation)object to add This value cannot be`null`. |

|                                                                                                                          Return                                                                                                                          ||
|----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | id of the added annotation, or -1 if the annotation cannot be added. The id is guaranteed to be non-negative if the annotation is added successfully. Value is -1 or greater |

|                                                                                                                                  Exceptions                                                                                                                                   ||
|--------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java.lang.IllegalArgumentException` | if the provided annotation is of unsupported type i.e.-[PdfAnnotationType.UNKNOWN](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfAnnotationType#UNKNOWN:kotlin.Int)or if the add operation failed.   |
| `java.lang.IllegalStateException`    | if[PdfRenderer](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer)or[PdfRenderer.Page](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#)is closed before invocation. |

### addPageObject

Added in[API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun addPageObject(pageObject: PdfPageObject): Int
```

Adds the given[PdfPageObject](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfPageObject)to the page.

[PdfRenderer.write](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer#write(android.os.ParcelFileDescriptor,%20kotlin.Boolean))needs to be called to get the updated PDF stream after calling this method.[PdfRenderer.Page](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#)instance can be closed before calling[PdfRenderer.write](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer#write(android.os.ParcelFileDescriptor,%20kotlin.Boolean)).

|                                                                                       Parameters                                                                                        ||
|--------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `pageObject` | [PdfPageObject](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfPageObject):the`PdfPageObject`object to add. This value cannot be`null`. |

|                                                                                                                Return                                                                                                                ||
|----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | id of the added page object, or -1 if the page object cannot be added. The id is guaranteed to be non-negative if the page object is added successfully. |

|                                                                                                                                                                                 Exceptions                                                                                                                                                                                 ||
|--------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java.lang.IllegalArgumentException` | if the provided[PdfPageObject](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfPageObject)is of unsupported type i.e.[PdfPageObjectType.UNKNOWN](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfPageObjectType#UNKNOWN:kotlin.Int)or if the add operation failed. |
| `java.lang.IllegalStateException`    | if the[PdfRenderer.Page](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#)is closed before invocation.                                                                                                                                                                                          |

### applyEdit

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun applyEdit(editRecord: FormEditRecord): MutableList<Rect!>
```

Applies a[FormEditRecord](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormEditRecord)to the PDF.

Apps must call[render(android.graphics.Bitmap,android.graphics.Rect,android.graphics.Matrix,android.graphics.pdf.RenderParams)](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#render(android.graphics.Bitmap,%20android.graphics.Rect,%20android.graphics.Matrix,%20android.graphics.pdf.RenderParams))to render new bitmaps for the corresponding areas of the page.

For click type[FormEditRecord](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormEditRecord)s, performs a click on[android.graphics.pdf.models.FormEditRecord#getClickPoint()](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormEditRecord#getClickPoint())

For set text type[FormEditRecord](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormEditRecord)s, sets the text value of the form widget.

For set indices type[FormEditRecord](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormEditRecord)s, sets the[android.graphics.pdf.models.FormEditRecord#getSelectedIndices()](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormEditRecord#getSelectedIndices())as selected and all others as unselected for the form widget indicated by the record.

|                                                                                                                                    Parameters                                                                                                                                     ||
|--------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `editRecord` | [FormEditRecord](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormEditRecord):the[FormEditRecord](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormEditRecord)to be applied This value cannot be`null`. |

|                                                                                                                                                  Return                                                                                                                                                   ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|
| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#)!> | Rectangular areas of the page bitmap that have been invalidated by this action. This value cannot be`null`. |

|                                                                                                                                      Exceptions                                                                                                                                      ||
|--------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java.lang.IllegalArgumentException` | if the provided[FormEditRecord](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormEditRecord)cannot be applied to the widget indicated by the index, or if the index does not correspond to a widget on the page. |
| `java.lang.IllegalStateException`    | If the page is already closed.                                                                                                                                                                                                                 |

### close

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun close(): Unit
```

Closes this page.

|                        Exceptions                        ||
|-----------------------|-----------------------------------|
| `java.lang.Exception` | if this resource cannot be closed |

**See Also**

- [android.graphics.pdf.PdfRenderer#openPage(int)](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer#openPage(kotlin.Int))  

### getFormWidgetInfoAtIndex

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getFormWidgetInfoAtIndex(widgetIndex: Int): FormWidgetInfo
```

Returns information about the widget with`widgetIndex`.

|                                                                                                                                                                                                                                                                                                                                                                 Parameters                                                                                                                                                                                                                                                                                                                                                                  ||
|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `widgetIndex` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the index of the widget within the page's widget annotations array in the PDF document, available on results of previous calls to[getFormWidgetInfos(int[])](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#getFormWidgetInfos(kotlin.IntArray))or[getFormWidgetInfoAtPosition(int,int)](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#getFormWidgetInfoAtPosition(kotlin.Int,%20kotlin.Int))via[FormWidgetInfo.getWidgetIndex()](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo#getWidgetIndex()). Value is 0 or greater |

|                                                                  Return                                                                  ||
|-------------------------------------------------------------------------------------------------------------|-----------------------------|
| [FormWidgetInfo](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo) | This value cannot be`null`. |

|                                       Exceptions                                        ||
|--------------------------------------|---------------------------------------------------|
| `java.lang.IllegalArgumentException` | if there is no form widget at the provided index. |
| `java.lang.IllegalStateException`    | if the renderer or page is closed                 |

### getFormWidgetInfoAtPosition

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getFormWidgetInfoAtPosition(
    x: Int, 
    y: Int
): FormWidgetInfo
```

Returns information about the widget at the given point.

|                                                             Parameters                                                              ||
|-----|--------------------------------------------------------------------------------------------------------------------------------|
| `x` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the x position of the widget on the page, in points |
| `y` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the y position of the widget on the page, in points |

|                                                                  Return                                                                  ||
|-------------------------------------------------------------------------------------------------------------|-----------------------------|
| [FormWidgetInfo](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo) | This value cannot be`null`. |

|                                         Exceptions                                         ||
|--------------------------------------|------------------------------------------------------|
| `java.lang.IllegalArgumentException` | if there is no form widget at the provided position. |
| `java.lang.IllegalStateException`    | if the renderer or page is closed                    |

### getFormWidgetInfos

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getFormWidgetInfos(): MutableList<FormWidgetInfo!>
```

Returns information about all form widgets on the page, or an empty list if there are no form widgets on the page.

|                                                                                                                       Return                                                                                                                       ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[FormWidgetInfo](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo)!> | This value cannot be`null`. |

|                              Exceptions                              ||
|-----------------------------------|-----------------------------------|
| `java.lang.IllegalStateException` | if the renderer or page is closed |

### getFormWidgetInfos

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getFormWidgetInfos(types: IntArray): MutableList<FormWidgetInfo!>
```

Returns information about all form widgets of the specified types on the page, or an empty list if there are no form widgets of the specified types on the page.

|                                                                                               Parameters                                                                                                ||
|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `types` | [IntArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int-array/index.html):the types of form widgets to return, or an empty array to return all widgets This value cannot be`null`. |

|                                                                                                                       Return                                                                                                                       ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[FormWidgetInfo](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/FormWidgetInfo)!> | This value cannot be`null`. |

|                              Exceptions                              ||
|-----------------------------------|-----------------------------------|
| `java.lang.IllegalStateException` | if the renderer or page is closed |

### getGotoLinks

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getGotoLinks(): MutableList<PdfPageGotoLinkContent!>
```

Gets bookmarks and goto links present on the page of a pdf document. Goto Links are the internal navigation links which directs the user to different location within the same document.

|                                                                                                                                                                                                                                  Return                                                                                                                                                                                                                                   ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[PdfPageGotoLinkContent](https://developer.android.com/reference/kotlin/android/graphics/pdf/content/PdfPageGotoLinkContent)!> | list of all goto links[PdfPageGotoLinkContent](https://developer.android.com/reference/kotlin/android/graphics/pdf/content/PdfPageGotoLinkContent)on a page, ordered left to right and top to bottom. This value cannot be`null`. |

|                                      Exceptions                                      ||
|-----------------------------------|---------------------------------------------------|
| `java.lang.IllegalStateException` | If the document/page is closed before invocation. |

### getHeight

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getHeight(): Int
```

Returns the height of the[PdfRenderer.Page](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#)object in points (1/72"). It is not guaranteed that all pages will have the same height and the viewport should be resized to the page height.

|                                                        Return                                                        ||
|----------------------------------------------------------------------------|------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | height of the page Value is 0 or greater |

|                                      Exceptions                                      ||
|-----------------------------------|---------------------------------------------------|
| `java.lang.IllegalStateException` | If the document/page is closed before invocation. |

### getImageContents

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getImageContents(): MutableList<PdfPageImageContent!>
```

Return list of[PdfPageImageContent](https://developer.android.com/reference/kotlin/android/graphics/pdf/content/PdfPageImageContent)found on the page, ordered left to right and top to bottom. It contains all the content associated with images found on the page including alt text. The list will be empty if there are no results found. Currently, localisation does not have any impact on the order in which[PdfPageImageContent](https://developer.android.com/reference/kotlin/android/graphics/pdf/content/PdfPageImageContent)is returned.

|                                                                                                                                                 Return                                                                                                                                                 ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------|
| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[PdfPageImageContent](https://developer.android.com/reference/kotlin/android/graphics/pdf/content/PdfPageImageContent)!> | list of image content found on the page. This value cannot be`null`. |

|                                      Exceptions                                      ||
|-----------------------------------|---------------------------------------------------|
| `java.lang.IllegalStateException` | If the document/page is closed before invocation. |

### getIndex

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getIndex(): Int
```

Gets the page index.

|                                                    Return                                                    ||
|----------------------------------------------------------------------------|----------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | The index. Value is 0 or greater |

### getLinkContents

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getLinkContents(): MutableList<PdfPageLinkContent!>
```

Get the bounds and URLs of all the links on the page.

|                                                                                                                                           Return                                                                                                                                           ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------|
| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[PdfPageLinkContent](https://developer.android.com/reference/kotlin/android/graphics/pdf/content/PdfPageLinkContent)!> | list of all links on the page. This value cannot be`null`. |

|                                      Exceptions                                      ||
|-----------------------------------|---------------------------------------------------|
| `java.lang.IllegalStateException` | If the document/page is closed before invocation. |

### getPageAnnotations

Added in[API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getPageAnnotations(): MutableList<Pair<Int!, PdfAnnotation!>!>
```

Returns a list of pairs, where each pair consists of a supported[PdfAnnotation](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfAnnotation)and its corresponding ID on the specified page. ID of the annotation will be required for[updatePageAnnotation(int,android.graphics.pdf.component.PdfAnnotation)](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#updatePageAnnotation(kotlin.Int,%20android.graphics.pdf.component.PdfAnnotation))and[removePageAnnotation(int)](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#removePageAnnotation(kotlin.Int))and will remain same without mutate operations.

The returned list will be empty if no supported annotations are present on the page, even if the page contains other annotation types. Refer to[PdfAnnotationType](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfAnnotationType)for the supported annotation types.

|                                                                                                                                                                                                                                                Return                                                                                                                                                                                                                                                 ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------|
| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[Pair](https://developer.android.com/reference/kotlin/android/util/Pair.html#)<[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!,` `[PdfAnnotation](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfAnnotation)!>!> | A list of pairs representing the supported annotations and their ids on the page. This value cannot be`null`. |

|                                                                                                                                 Exceptions                                                                                                                                 ||
|-----------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java.lang.IllegalStateException` | if[PdfRenderer](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer)or[PdfRenderer.Page](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#)is closed before invocation. |

### getPageObjects

Added in[API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getPageObjects(): MutableList<Pair<Int!, PdfPageObject!>!>
```

Returns[List](https://developer.android.com/reference/kotlin/java/util/List.html#)of[Pair](https://developer.android.com/reference/kotlin/android/util/Pair.html#)objects, where each pair contains: - An[Integer](https://developer.android.com/reference/kotlin/java/lang/Integer.html#)representing the object ID, which is required for[updatePageObject(int,android.graphics.pdf.component.PdfPageObject)](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#updatePageObject(kotlin.Int,%20android.graphics.pdf.component.PdfPageObject))and[removePageObject(int)](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#removePageObject(kotlin.Int)). Object ID will remain same without mutate operations. - A[PdfPageObject](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfPageObject)representing the page object.

The list will be empty if there are no supported page objects present on the page, even if the page contains other page object types.

|                                                                                                                                                                                                                                                                                                                                                                                               Return                                                                                                                                                                                                                                                                                                                                                                                               ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[Pair](https://developer.android.com/reference/kotlin/android/util/Pair.html#)<[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!,` `[PdfPageObject](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfPageObject)!>!> | [List](https://developer.android.com/reference/kotlin/java/util/List.html#)of[Pair](https://developer.android.com/reference/kotlin/android/util/Pair.html#)objects containing[Integer](https://developer.android.com/reference/kotlin/java/lang/Integer.html#)and[PdfPageObject](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfPageObject). This value cannot be`null`. |

|                                                                                   Exceptions                                                                                   ||
|-----------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|
| `java.lang.IllegalStateException` | if the[PdfRenderer.Page](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#)is closed before invocation. |

### getTextContents

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getTextContents(): MutableList<PdfPageTextContent!>
```

Return list of[PdfPageTextContent](https://developer.android.com/reference/kotlin/android/graphics/pdf/content/PdfPageTextContent)found on the page, ordered left to right and top to bottom. It contains all the content associated with text found on the page. The list will be empty if there are no results found. Currently, localisation does not have any impact on the order in which[PdfPageTextContent](https://developer.android.com/reference/kotlin/android/graphics/pdf/content/PdfPageTextContent)is returned.

|                                                                                                                                               Return                                                                                                                                                ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------|
| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[PdfPageTextContent](https://developer.android.com/reference/kotlin/android/graphics/pdf/content/PdfPageTextContent)!> | list of text content found on the page. This value cannot be`null`. |

|                                      Exceptions                                      ||
|-----------------------------------|---------------------------------------------------|
| `java.lang.IllegalStateException` | If the document/page is closed before invocation. |

### getTopPageObjectAtPosition

Added in[API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getTopPageObjectAtPosition(
    point: PointF, 
    types: IntArray
): Pair<Int!, PdfPageObject!>?
```

Retrieves the top-most page object at a specified position.

|                                                                                                                                                                                                                                                                                                          Parameters                                                                                                                                                                                                                                                                                                           ||
|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `point` | [PointF](https://developer.android.com/reference/kotlin/android/graphics/PointF.html#):The coordinates (as a[PointF](https://developer.android.com/reference/kotlin/android/graphics/PointF.html#)) on the page to check for page objects. This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                               |
| `types` | [IntArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int-array/index.html):An array of PdfPageObjectType.Type values. Only page objects whose types are included in this array will be considered. If multiple matching objects overlap at the specified point, only the one with the highest z-index will be returned. The order of types within this array does not influence the outcome. If this array is empty, known supported[PdfPageObjectType](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfPageObjectType)s will be considered. This value cannot be`null`. |

|                                                                                                                                                                                                                                                                                                                                                             Return                                                                                                                                                                                                                                                                                                                                                              ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Pair](https://developer.android.com/reference/kotlin/android/util/Pair.html#)<[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!,` `[PdfPageObject](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfPageObject)!>? | A[Pair](https://developer.android.com/reference/kotlin/android/util/Pair.html#)containing: - An[Integer](https://developer.android.com/reference/kotlin/java/lang/Integer.html#)representing the unique ID of the page object. - A[PdfPageObject](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfPageObject)representing the found page object. Returns null if no page object is found at the given position. |

|                                                                                    Exceptions                                                                                    ||
|--------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
| `java.lang.IllegalStateException`    | if the[PdfRenderer.Page](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#)is closed before invocation |
| `java.lang.IllegalArgumentException` | if the provided type(s) are not supported.                                                                                                 |

### getWidth

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getWidth(): Int
```

Returns the width of the[PdfRenderer.Page](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#)object in points (1/72"). It is not guaranteed that all pages will have the same width and the viewport should be resized to the page width.

|                                                       Return                                                        ||
|----------------------------------------------------------------------------|-----------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | width of the page Value is 0 or greater |

|                                      Exceptions                                      ||
|-----------------------------------|---------------------------------------------------|
| `java.lang.IllegalStateException` | If the document/page is closed before invocation. |

### removePageAnnotation

Added in[API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun removePageAnnotation(annotationId: Int): Unit
```

Removes the annotation with the specified id.

[PdfRenderer.write](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer#write(android.os.ParcelFileDescriptor,%20kotlin.Boolean))needs to be called to get the updated PDF stream after calling this method.[PdfRenderer.Page](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#)instance can be closed before calling[PdfRenderer.write](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer#write(android.os.ParcelFileDescriptor,%20kotlin.Boolean)).

|                                                                          Parameters                                                                           ||
|----------------|-----------------------------------------------------------------------------------------------------------------------------------------------|
| `annotationId` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):id of the annotation to remove from the page Value is 0 or greater |

|                                                                                                                                                              Exceptions                                                                                                                                                               ||
|--------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java.lang.IllegalArgumentException` | if annotationId is negative or invalid or if the remove operation failed.                                                                                                                                                                                                                       |
| `java.lang.IllegalStateException`    | if[PdfRenderer](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer)or[PdfRenderer.Page](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#)is closed before invocation or if annotation is failed to get removed from the page. |

### removePageObject

Added in[API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun removePageObject(objectId: Int): Unit
```

Removes the[PdfPageObject](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfPageObject)with the specified ID.

[PdfRenderer.write](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer#write(android.os.ParcelFileDescriptor,%20kotlin.Boolean))needs to be called to get the updated PDF stream after calling this method.[PdfRenderer.Page](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#)instance can be closed before calling[PdfRenderer.write](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer#write(android.os.ParcelFileDescriptor,%20kotlin.Boolean)).

|                                                                           Parameters                                                                            ||
|------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
| `objectId` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):the id of the page object to remove from the page. Value is 0 or greater |

|                                                        Exceptions                                                        ||
|--------------------------------------|------------------------------------------------------------------------------------|
| `java.lang.IllegalArgumentException` | if the provided objectId is negative or invalid or if the remove operation failed. |
| `java.lang.IllegalStateException`    | if the page object cannot be removed.                                              |

### render

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun render(
    destination: Bitmap, 
    destClip: Rect?, 
    transform: Matrix?, 
    params: RenderParams
): Unit
```

Renders a page to a bitmap. In case of default zoom, the[Bitmap](https://developer.android.com/reference/kotlin/android/graphics/Bitmap.html#)dimensions will be equal to the page dimensions. In this case,[Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#)parameter can be null.

In case of zoom, the[Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#)parameter needs to be specified which represents the offset from top and left for tile generation purposes. In this case, the[Bitmap](https://developer.android.com/reference/kotlin/android/graphics/Bitmap.html#)dimensions should be equal to the tile dimensions.

**Note:** The method will take care of closing the bitmap. Should be invoked on the[android.annotation.WorkerThread](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#)as it is long-running task.

|                                                                                                                           Parameters                                                                                                                            ||
|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `destination` | [Bitmap](https://developer.android.com/reference/kotlin/android/graphics/Bitmap.html#):Destination bitmap to write to. This value cannot be`null`.                                                                                               |
| `destClip`    | [Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#)?:If null, default zoom is applied. In case the value is non-null, the value specifies the top top-left corner of the tile.                                    |
| `transform`   | [Matrix](https://developer.android.com/reference/kotlin/android/graphics/Matrix.html#)?:Applied to scale the bitmap up/down from default 1/72 points. This value may be`null`.                                                                   |
| `params`      | [RenderParams](https://developer.android.com/reference/kotlin/android/graphics/pdf/RenderParams):Render params for the changing display mode, and / or to control the appearance of annotations and PDF form content This value cannot be`null`. |

|                                      Exceptions                                      ||
|-----------------------------------|---------------------------------------------------|
| `java.lang.IllegalStateException` | If the document/page is closed before invocation. |

### render

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun render(
    destination: Bitmap, 
    destClip: Rect?, 
    transform: Matrix?, 
    renderMode: Int
): Unit
```

Renders a page to a bitmap.

You may optionally specify a rectangular clip in the bitmap bounds. No rendering outside the clip will be performed, hence it is your responsibility to initialize the bitmap outside the clip.

You may optionally specify a matrix to transform the content from page coordinates which are in points (1/72") to bitmap coordinates which are in pixels. If this matrix is not provided this method will apply a transformation that will fit the whole page to the destination clip if provided or the destination bitmap if no clip is provided.

The clip and transformation are useful for implementing tile rendering where the destination bitmap contains a portion of the image, for example when zooming. Another useful application is for printing where the size of the bitmap holding the page is too large and a client can render the page in stripes.

**Note:** The destination bitmap format must be[ARGB](https://developer.android.com/reference/kotlin/android/graphics/Bitmap.Config.html#).

**Note:** The optional transformation matrix must be affine as per[Matrix.isAffine()](https://developer.android.com/reference/kotlin/android/graphics/Matrix.html#isAffine()). Hence, you can specify rotation, scaling, translation but not a perspective transformation.

|                                                                                                                                                                                                                                             Parameters                                                                                                                                                                                                                                              ||
|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `destination` | [Bitmap](https://developer.android.com/reference/kotlin/android/graphics/Bitmap.html#):Destination bitmap to which to render. This value cannot be`null`.                                                                                                                                                                                                                                                                                                                            |
| `destClip`    | [Rect](https://developer.android.com/reference/kotlin/android/graphics/Rect.html#)?:Optional clip in the bitmap bounds. This value may be`null`.                                                                                                                                                                                                                                                                                                                                     |
| `transform`   | [Matrix](https://developer.android.com/reference/kotlin/android/graphics/Matrix.html#)?:Optional transformation to apply when rendering. This value may be`null`.                                                                                                                                                                                                                                                                                                                    |
| `renderMode`  | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The render mode. Value is[android.graphics.pdf.PdfRenderer.Page#RENDER_MODE_FOR_DISPLAY](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#RENDER_MODE_FOR_DISPLAY:kotlin.Int), or[android.graphics.pdf.PdfRenderer.Page#RENDER_MODE_FOR_PRINT](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#RENDER_MODE_FOR_PRINT:kotlin.Int) |

**See Also**

- [#RENDER_MODE_FOR_DISPLAY](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#RENDER_MODE_FOR_DISPLAY:kotlin.Int)
- [#RENDER_MODE_FOR_PRINT](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#RENDER_MODE_FOR_PRINT:kotlin.Int)  

### searchText

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun searchText(query: String): MutableList<PageMatchBounds!>
```

Search for the given string on the page and returns the bounds of all the matches. The list will be empty if there are no matches on the page. If this function was invoked previously for any page, it will wait for that operation to complete before this operation is started.

**Note:** Should be invoked on the[android.annotation.WorkerThread](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#)as it is long-running task.

|                                                                             Parameters                                                                              ||
|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `query` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):plain search string for querying the document This value cannot be`null`. |

|                                                                                                                                                                                                           Return                                                                                                                                                                                                            ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)<[PageMatchBounds](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/PageMatchBounds)!> | List of[PageMatchBounds](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/PageMatchBounds)representing the bounds of each match on the page. This value cannot be`null`. |

|                                      Exceptions                                      ||
|-----------------------------------|---------------------------------------------------|
| `java.lang.IllegalStateException` | If the document/page is closed before invocation. |

### selectContent

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun selectContent(
    start: SelectionBoundary, 
    stop: SelectionBoundary
): PageSelection?
```

Return a[PageSelection](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/selection/PageSelection)which represents the selected content that spans between the two boundaries. The boundaries can be either exactly defined with text indexes, or approximately defined with points on the page. The resulting selection will also be exactly defined with both indexes and points. If the start and stop boundary are both at the same point, selects the word at that point. In case the selection from the given boundaries result in an empty space, then the method returns`null`. The start and stop[SelectionBoundary](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/selection/SelectionBoundary)in[PageSelection](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/selection/PageSelection)resolves to the "nearest" index when returned.

**Note:** Should be invoked on a[android.annotation.WorkerThread](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#)as it is long-running task.

|                                                                                                    Parameters                                                                                                    ||
|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `start` | [SelectionBoundary](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/selection/SelectionBoundary):boundary where the selection starts (inclusive) This value cannot be`null`. |
| `stop`  | [SelectionBoundary](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/selection/SelectionBoundary):boundary where the selection stops (exclusive) This value cannot be`null`.  |

|                                                                                     Return                                                                                      ||
|----------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------|
| [PageSelection](https://developer.android.com/reference/kotlin/android/graphics/pdf/models/selection/PageSelection)? | collection of the selected content for text, images, etc. |

|                                      Exceptions                                      ||
|-----------------------------------|---------------------------------------------------|
| `java.lang.IllegalStateException` | If the document/page is closed before invocation. |

### updatePageAnnotation

Added in[API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun updatePageAnnotation(
    annotationId: Int, 
    annotation: PdfAnnotation
): Boolean
```

Update the given[PdfAnnotation](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfAnnotation)to the page.

Note: The[PdfAnnotationType](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfAnnotationType)of the provided annotation must be the same as the original annotation being updated.

[PdfRenderer.write](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer#write(android.os.ParcelFileDescriptor,%20kotlin.Boolean))needs to be called to get the updated PDF stream after calling this method.[PdfRenderer.Page](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#)instance can be closed before calling[PdfRenderer.write](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer#write(android.os.ParcelFileDescriptor,%20kotlin.Boolean)).

|                                                                                    Parameters                                                                                     ||
|----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `annotationId` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):id corresponding to which the annotation is to be updated Value is 0 or greater        |
| `annotation`   | [PdfAnnotation](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfAnnotation):the annotation to update This value cannot be`null`. |

|                                                               Return                                                               ||
|------------------------------------------------------------------------------------|------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | true if annotation is updated, false otherwise |

|                                                                                                                                                                                                                                         Exceptions                                                                                                                                                                                                                                          ||
|--------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java.lang.IllegalArgumentException` | if the provided annotation is of unsupported type i.e.[PdfAnnotationType.UNKNOWN](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfAnnotationType#UNKNOWN:kotlin.Int)or if the provided annotationId is negative or if[PdfAnnotationType](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfAnnotationType)of the provided annotation is different from the original annotation's type |
| `java.lang.IllegalStateException`    | if[PdfRenderer](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer)or[PdfRenderer.Page](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#)is closed before invocation                                                                                                                                                                                                                |

### updatePageObject

Added in[API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun updatePageObject(
    objectId: Int, 
    pageObject: PdfPageObject
): Boolean
```

Update the given[PdfPageObject](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfPageObject)to the page.

Note: This method only updates the parameters of the PageObject whose setters are available. Attempting to update fields with no corresponding setters will have no effect. Furthermore, the[PdfPageObjectType](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfPageObjectType)of the provided pageObject must be the same as the original pageObject being updated.

[PdfRenderer.write](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer#write(android.os.ParcelFileDescriptor,%20kotlin.Boolean))needs to be called to get the updated PDF stream after calling this method.[PdfRenderer.Page](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#)instance can be closed before calling[PdfRenderer.write](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer#write(android.os.ParcelFileDescriptor,%20kotlin.Boolean)).

|                                                                                         Parameters                                                                                         ||
|--------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `objectId`   | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The unique identifier of the page object to update. Value is 0 or greater                         |
| `pageObject` | [PdfPageObject](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfPageObject):The`PdfPageObject`object to update. This value cannot be`null`. |

|                                                                Return                                                                ||
|------------------------------------------------------------------------------------|--------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | true if page object is updated, false otherwise. |

|                                                                                                                                                                                        Exceptions                                                                                                                                                                                         ||
|--------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java.lang.IllegalArgumentException` | if the provided[PdfPageObject](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfPageObject)is unsupported or if the[PdfPageObjectType](https://developer.android.com/reference/kotlin/android/graphics/pdf/component/PdfPageObjectType)of the provided pageObject is different from the original pageObject's type. |
| `java.lang.IllegalStateException`    | if the[PdfRenderer.Page](https://developer.android.com/reference/kotlin/android/graphics/pdf/PdfRenderer.Page#)is closed before invocation.                                                                                                                                                                                                         |

## Protected methods

### finalize

Added in[API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
protected fun finalize(): Unit
```

|                         Exceptions                         ||
|-----------------------|-------------------------------------|
| `java.lang.Throwable` | the`Exception`raised by this method |