# PdfDocument

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

*** ** * ** ***


```
public interface PdfDocument extends Closeable
```

<br />

Known direct subclasses [EditablePdfDocument](https://developer.android.com/reference/androidx/pdf/EditablePdfDocument)

|---|---|
| `https://developer.android.com/reference/androidx/pdf/EditablePdfDocument` | Represents a PDF document that allows for editing. |

*** ** * ** ***

Represents a PDF document and provides methods to interact with its content.

## Summary

| ### Nested types |
|---|
| `public interface https://developer.android.com/reference/androidx/pdf/PdfDocument.BitmapSource extends https://developer.android.com/reference/java/io/Closeable.html` A source for retrieving bitmap representations of PDF pages. |
| `@https://developer.android.com/reference/androidx/pdf/ExperimentalPdfApi public interface https://developer.android.com/reference/androidx/pdf/PdfDocument.OnEditAppliedListener` Interface definition for a callback that notifies when an edit is applied using the `https://developer.android.com/reference/androidx/pdf/EditablePdfDocument#applyEdits(androidx.pdf.EditsDraft)` method. |
| `public interface https://developer.android.com/reference/androidx/pdf/PdfDocument.OnPdfContentInvalidatedListener` Listener interface for receiving notifications when some regions of the PDF content are invalidated. |
| `public final class https://developer.android.com/reference/androidx/pdf/PdfDocument.PageInfo` Represents information about a single page in the PDF document. |
| `public final class https://developer.android.com/reference/androidx/pdf/PdfDocument.PdfPageContent` Represents the combined text and image content within a single page of a PDF document. |
| `public final class https://developer.android.com/reference/androidx/pdf/PdfDocument.PdfPageLinks` Represents the links within a single page of a PDF document. |

| ### Constants |
|---|---|
| `default static final long` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#FORM_WIDGET_INCLUDE_ALL_TYPES()` Flag to include all types of form widgets in `https://developer.android.com/reference/androidx/pdf/PdfDocument#getFormWidgetInfos(kotlin.Int,kotlin.Long)` |
| `default static final long` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#FORM_WIDGET_INCLUDE_CHECKBOX_TYPE()` Flag to include `https://developer.android.com/reference/androidx/pdf/models/FormWidgetInfo#WIDGET_TYPE_CHECKBOX()` in `https://developer.android.com/reference/androidx/pdf/PdfDocument#getFormWidgetInfos(kotlin.Int,kotlin.Long)` |
| `default static final long` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#FORM_WIDGET_INCLUDE_COMBOBOX_TYPE()` Flag to include `https://developer.android.com/reference/androidx/pdf/models/FormWidgetInfo#WIDGET_TYPE_COMBOBOX()` in `https://developer.android.com/reference/androidx/pdf/PdfDocument#getFormWidgetInfos(kotlin.Int,kotlin.Long)` |
| `default static final long` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#FORM_WIDGET_INCLUDE_LISTBOX_TYPE()` Flag to include `https://developer.android.com/reference/androidx/pdf/models/FormWidgetInfo#WIDGET_TYPE_LISTBOX()` in `https://developer.android.com/reference/androidx/pdf/PdfDocument#getFormWidgetInfos(kotlin.Int,kotlin.Long)` |
| `default static final long` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#FORM_WIDGET_INCLUDE_PUSHBUTTON_TYPE()` Flag to include `https://developer.android.com/reference/androidx/pdf/models/FormWidgetInfo#WIDGET_TYPE_PUSHBUTTON()` in `https://developer.android.com/reference/androidx/pdf/PdfDocument#getFormWidgetInfos(kotlin.Int,kotlin.Long)` |
| `default static final long` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#FORM_WIDGET_INCLUDE_RADIOBUTTON_TYPE()` Flag to include `https://developer.android.com/reference/androidx/pdf/models/FormWidgetInfo#WIDGET_TYPE_RADIOBUTTON()` in `https://developer.android.com/reference/androidx/pdf/PdfDocument#getFormWidgetInfos(kotlin.Int,kotlin.Long)` |
| `default static final long` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#FORM_WIDGET_INCLUDE_SIGNATURE_TYPE()` Flag to include `https://developer.android.com/reference/androidx/pdf/models/FormWidgetInfo#WIDGET_TYPE_SIGNATURE()` in `https://developer.android.com/reference/androidx/pdf/PdfDocument#getFormWidgetInfos(kotlin.Int,kotlin.Long)` |
| `default static final long` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#FORM_WIDGET_INCLUDE_TEXTFIELD_TYPE()` Flag to include `https://developer.android.com/reference/androidx/pdf/models/FormWidgetInfo#WIDGET_TYPE_TEXTFIELD()` in `https://developer.android.com/reference/androidx/pdf/PdfDocument#getFormWidgetInfos(kotlin.Int,kotlin.Long)` |
| `default static final long` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#FORM_WIDGET_INCLUDE_UNKNOWN_TYPE()` Flag to include `https://developer.android.com/reference/androidx/pdf/models/FormWidgetInfo#WIDGET_TYPE_UNKNOWN()` in `https://developer.android.com/reference/androidx/pdf/PdfDocument#getFormWidgetInfos(kotlin.Int,kotlin.Long)` |
| `default static final int` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#LINEARIZATION_STATUS_LINEARIZED() = 1` Indicates that the document is linearized (optimized for fast web viewing) |
| `default static final int` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#LINEARIZATION_STATUS_NOT_LINEARIZED() = 0` Indicates that the document is not linearized |
| `default static final int` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#LINEARIZATION_STATUS_UNKNOWN() = 2` Indicates that the linearization status of the document could not be determined |
| `default static final long` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#PAGE_INFO_EXCLUDE_FORM_WIDGETS() = 0` Flag used with `https://developer.android.com/reference/androidx/pdf/PdfDocument#getPageInfo(kotlin.Int)` to exclude any additional information in the returned `https://developer.android.com/reference/androidx/pdf/PdfDocument.PageInfo` |
| `default static final long` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#PAGE_INFO_INCLUDE_FORM_WIDGET()` Flag used with `https://developer.android.com/reference/androidx/pdf/PdfDocument#getPageInfo(kotlin.Int)` to include form widget metadata in the `https://developer.android.com/reference/androidx/pdf/PdfDocument.PageInfo` |
| `default static final int` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#PDF_FORM_TYPE_ACRO_FORM() = 1` Represents a PDF with form fields specified using the AcroForm spec |
| `default static final int` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#PDF_FORM_TYPE_NONE() = 0` Represents a PDF with no form fields |
| `default static final int` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#PDF_FORM_TYPE_XFA_FOREGROUND() = 3` Represents a PDF with form fields specified using the XFAF subset of the XFA spec |
| `default static final int` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#PDF_FORM_TYPE_XFA_FULL() = 2` Represents a PDF with form fields specified using the entire XFA spec |

| ### Public methods |
|---|---|
| `default void` | `@https://developer.android.com/reference/androidx/pdf/ExperimentalPdfApi https://developer.android.com/reference/androidx/pdf/PdfDocument#addOnEditAppliedListener(java.util.concurrent.Executor,androidx.pdf.PdfDocument.OnEditAppliedListener)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/concurrent/Executor.html executor, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/PdfDocument.OnEditAppliedListener listener )` Adds a listener to be notified when an edit is applied on the document. |
| `abstract void` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#addOnPdfContentInvalidatedListener(java.util.concurrent.Executor,androidx.pdf.PdfDocument.OnPdfContentInvalidatedListener)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/concurrent/Executor.html executor, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/PdfDocument.OnPdfContentInvalidatedListener listener )` Adds a listener to receive notifications when some regions of the PDF content are invalidated. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/annotation/content/KeyedPdfAnnotation>` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#getAnnotationsForPage(kotlin.Int)(int pageNum)` Retrieves a list of all annotations for the specified page. |
| `abstract int` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#getFormType()()` The type of form present in the document. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/models/FormWidgetInfo>` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#getFormWidgetInfos(kotlin.Int,kotlin.Long)(int pageNum, long types)` Returns the list of `https://developer.android.com/reference/androidx/pdf/models/FormWidgetInfo` on `https://developer.android.com/reference/androidx/pdf/PdfDocument#getFormWidgetInfos(kotlin.Int,kotlin.Long)`, optionally filtered by widget type. |
| `abstract int` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#getLinearizationStatus()()` Indicates the linearization status of the document. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/PdfDocument.BitmapSource` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#getPageBitmapSource(kotlin.Int)(int pageNumber)` Gets a `https://developer.android.com/reference/androidx/pdf/PdfDocument.BitmapSource` for retrieving bitmap representations of the specified page. |
| `abstract https://developer.android.com/reference/androidx/pdf/PdfDocument.PdfPageContent` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#getPageContent(kotlin.Int)(int pageNumber)` Asynchronously retrieves the content (text and images) of the specified page. |
| `abstract int` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#getPageCount()()` The total number of pages in the document. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/PdfDocument.PageInfo` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#getPageInfo(kotlin.Int)(int pageNumber)` Asynchronously retrieves information about the specified page. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/PdfDocument.PageInfo` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#getPageInfo(kotlin.Int,kotlin.Long)(int pageNumber, long pageInfoFlags)` Asynchronously retrieves information about the specified page. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/PdfDocument.PageInfo>` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#getPageInfos(kotlin.ranges.IntRange)(@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.ranges/-int-range/index.html pageRange)` Asynchronously retrieves information about a range of pages. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/PdfDocument.PageInfo>` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#getPageInfos(kotlin.ranges.IntRange,kotlin.Long)(@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.ranges/-int-range/index.html pageRange, long pageInfoFlags)` Asynchronously retrieves information about a range of pages. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/PdfDocument.PdfPageLinks` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#getPageLinks(kotlin.Int)(int pageNumber)` Asynchronously retrieves the links (Go To and external) present on the specified page. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/RenderParams` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#getRenderParams()()` The render params used to determine the contents that will be rendered on the bitmap. |
| `abstract https://developer.android.com/reference/androidx/pdf/content/PageSelection` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#getSelectionBounds(kotlin.Int,android.graphics.PointF,android.graphics.PointF)( int pageNumber, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/PointF.html start, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/PointF.html stop )` Asynchronously retrieves the selection bounds (in PDF coordinates) for the specified text selection. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#getUri()()` The URI of the document represented by this object |
| `default void` | `@https://developer.android.com/reference/androidx/pdf/ExperimentalPdfApi https://developer.android.com/reference/androidx/pdf/PdfDocument#removeOnEditAppliedListener(androidx.pdf.PdfDocument.OnEditAppliedListener)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/PdfDocument.OnEditAppliedListener listener )` Remove a listener for applied edits. |
| `abstract void` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#removeOnPdfContentInvalidatedListener(androidx.pdf.PdfDocument.OnPdfContentInvalidatedListener)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/PdfDocument.OnPdfContentInvalidatedListener listener )` Removes the listener from the list of listeners which are notified when some regions of the PDF content are invalidated. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/SparseArray.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/content/PageMatchBounds>>` | `https://developer.android.com/reference/androidx/pdf/PdfDocument#searchDocument(kotlin.String,kotlin.ranges.IntRange)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html query, @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.ranges/-int-range/index.html pageRange)` Asynchronously searches the document for the specified query within a range of pages. |

### Inherited methods

From [java.io.Closeable](https://developer.android.com/reference/java/io/Closeable.html) `abstract void` `https://developer.android.com/reference/java/io/Closeable.html#close()()`

## Constants

### FORM_WIDGET_INCLUDE_ALL_TYPES

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

```
default static final long FORM_WIDGET_INCLUDE_ALL_TYPES
```

Flag to include all types of form widgets in `https://developer.android.com/reference/androidx/pdf/PdfDocument#getFormWidgetInfos(kotlin.Int,kotlin.Long)`

### FORM_WIDGET_INCLUDE_CHECKBOX_TYPE

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

```
default static final long FORM_WIDGET_INCLUDE_CHECKBOX_TYPE
```

Flag to include `https://developer.android.com/reference/androidx/pdf/models/FormWidgetInfo#WIDGET_TYPE_CHECKBOX()` in `https://developer.android.com/reference/androidx/pdf/PdfDocument#getFormWidgetInfos(kotlin.Int,kotlin.Long)`

### FORM_WIDGET_INCLUDE_COMBOBOX_TYPE

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

```
default static final long FORM_WIDGET_INCLUDE_COMBOBOX_TYPE
```

Flag to include `https://developer.android.com/reference/androidx/pdf/models/FormWidgetInfo#WIDGET_TYPE_COMBOBOX()` in `https://developer.android.com/reference/androidx/pdf/PdfDocument#getFormWidgetInfos(kotlin.Int,kotlin.Long)`

### FORM_WIDGET_INCLUDE_LISTBOX_TYPE

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

```
default static final long FORM_WIDGET_INCLUDE_LISTBOX_TYPE
```

Flag to include `https://developer.android.com/reference/androidx/pdf/models/FormWidgetInfo#WIDGET_TYPE_LISTBOX()` in `https://developer.android.com/reference/androidx/pdf/PdfDocument#getFormWidgetInfos(kotlin.Int,kotlin.Long)`

### FORM_WIDGET_INCLUDE_PUSHBUTTON_TYPE

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

```
default static final long FORM_WIDGET_INCLUDE_PUSHBUTTON_TYPE
```

Flag to include `https://developer.android.com/reference/androidx/pdf/models/FormWidgetInfo#WIDGET_TYPE_PUSHBUTTON()` in `https://developer.android.com/reference/androidx/pdf/PdfDocument#getFormWidgetInfos(kotlin.Int,kotlin.Long)`

### FORM_WIDGET_INCLUDE_RADIOBUTTON_TYPE

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

```
default static final long FORM_WIDGET_INCLUDE_RADIOBUTTON_TYPE
```

Flag to include `https://developer.android.com/reference/androidx/pdf/models/FormWidgetInfo#WIDGET_TYPE_RADIOBUTTON()` in `https://developer.android.com/reference/androidx/pdf/PdfDocument#getFormWidgetInfos(kotlin.Int,kotlin.Long)`

### FORM_WIDGET_INCLUDE_SIGNATURE_TYPE

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

```
default static final long FORM_WIDGET_INCLUDE_SIGNATURE_TYPE
```

Flag to include `https://developer.android.com/reference/androidx/pdf/models/FormWidgetInfo#WIDGET_TYPE_SIGNATURE()` in `https://developer.android.com/reference/androidx/pdf/PdfDocument#getFormWidgetInfos(kotlin.Int,kotlin.Long)`

### FORM_WIDGET_INCLUDE_TEXTFIELD_TYPE

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

```
default static final long FORM_WIDGET_INCLUDE_TEXTFIELD_TYPE
```

Flag to include `https://developer.android.com/reference/androidx/pdf/models/FormWidgetInfo#WIDGET_TYPE_TEXTFIELD()` in `https://developer.android.com/reference/androidx/pdf/PdfDocument#getFormWidgetInfos(kotlin.Int,kotlin.Long)`

### FORM_WIDGET_INCLUDE_UNKNOWN_TYPE

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

```
default static final long FORM_WIDGET_INCLUDE_UNKNOWN_TYPE
```

Flag to include `https://developer.android.com/reference/androidx/pdf/models/FormWidgetInfo#WIDGET_TYPE_UNKNOWN()` in `https://developer.android.com/reference/androidx/pdf/PdfDocument#getFormWidgetInfos(kotlin.Int,kotlin.Long)`

### LINEARIZATION_STATUS_LINEARIZED

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

```
default static final int LINEARIZATION_STATUS_LINEARIZED = 1
```

Indicates that the document is linearized (optimized for fast web viewing)

### LINEARIZATION_STATUS_NOT_LINEARIZED

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

```
default static final int LINEARIZATION_STATUS_NOT_LINEARIZED = 0
```

Indicates that the document is not linearized

### LINEARIZATION_STATUS_UNKNOWN

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

```
default static final int LINEARIZATION_STATUS_UNKNOWN = 2
```

Indicates that the linearization status of the document could not be determined

### PAGE_INFO_EXCLUDE_FORM_WIDGETS

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

```
default static final long PAGE_INFO_EXCLUDE_FORM_WIDGETS = 0
```

Flag used with `https://developer.android.com/reference/androidx/pdf/PdfDocument#getPageInfo(kotlin.Int)` to exclude any additional information in the returned `https://developer.android.com/reference/androidx/pdf/PdfDocument.PageInfo`

### PAGE_INFO_INCLUDE_FORM_WIDGET

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

```
default static final long PAGE_INFO_INCLUDE_FORM_WIDGET
```

Flag used with `https://developer.android.com/reference/androidx/pdf/PdfDocument#getPageInfo(kotlin.Int)` to include form widget metadata in the `https://developer.android.com/reference/androidx/pdf/PdfDocument.PageInfo`

### PDF_FORM_TYPE_ACRO_FORM

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

```
default static final int PDF_FORM_TYPE_ACRO_FORM = 1
```

Represents a PDF with form fields specified using the AcroForm spec

### PDF_FORM_TYPE_NONE

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

```
default static final int PDF_FORM_TYPE_NONE = 0
```

Represents a PDF with no form fields

### PDF_FORM_TYPE_XFA_FOREGROUND

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

```
default static final int PDF_FORM_TYPE_XFA_FOREGROUND = 3
```

Represents a PDF with form fields specified using the XFAF subset of the XFA spec

### PDF_FORM_TYPE_XFA_FULL

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

```
default static final int PDF_FORM_TYPE_XFA_FULL = 2
```

Represents a PDF with form fields specified using the entire XFA spec

## Public methods

### addOnEditAppliedListener

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

```
@ExperimentalPdfApi
default void addOnEditAppliedListener(
    @NonNull Executor executor,
    @NonNull PdfDocument.OnEditAppliedListener listener
)
```

Adds a listener to be notified when an edit is applied on the document. Remove the listener using `https://developer.android.com/reference/androidx/pdf/PdfDocument#removeOnEditAppliedListener(androidx.pdf.PdfDocument.OnEditAppliedListener)`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/concurrent/Executor.html executor` | The executor on which the listener's methods will be called. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/PdfDocument.OnEditAppliedListener listener` | the listener to add. |

### addOnPdfContentInvalidatedListener

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

```
abstract void addOnPdfContentInvalidatedListener(
    @NonNull Executor executor,
    @NonNull PdfDocument.OnPdfContentInvalidatedListener listener
)
```

Adds a listener to receive notifications when some regions of the PDF content are invalidated.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/concurrent/Executor.html executor` | The executor on which the listener's methods will be called. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/PdfDocument.OnPdfContentInvalidatedListener listener` | The listener to add. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/pdf/PdfDocument.OnPdfContentInvalidatedListener` |   |

### getAnnotationsForPage

```
abstract @NonNull List<@NonNull KeyedPdfAnnotation> getAnnotationsForPage(int pageNum)
```

Retrieves a list of all annotations for the specified page.

| Parameters |
|---|---|
| `int pageNum` | The page number (0-indexed) from which to retrieve edits. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/annotation/content/KeyedPdfAnnotation>` | A list of `https://developer.android.com/reference/androidx/pdf/annotation/content/KeyedPdfAnnotation` objects on the page. Returns an empty list if there are no edits on the page. |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if the page number is invalid. |

### getFormType

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

```
abstract int getFormType()
```

The type of form present in the document.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/pdf/PdfDocument.FormType` | for the supported types. |

### getFormWidgetInfos

```
abstract @NonNull List<@NonNull FormWidgetInfo> getFormWidgetInfos(int pageNum, long types)
```

Returns the list of `https://developer.android.com/reference/androidx/pdf/models/FormWidgetInfo` on `https://developer.android.com/reference/androidx/pdf/PdfDocument#getFormWidgetInfos(kotlin.Int,kotlin.Long)`, optionally filtered by widget type.

| Parameters |
|---|---|
| `int pageNum` | The page number (0-based). |
| `long types` | Bitmask to determine the types of form widgets to include in the result. Includes all types of form widgets by default. Value is either `0` or a combination of the following: - `-1` - `2` - `4` - `8` - `16` - `32` - `64` - `128` <br /> |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/models/FormWidgetInfo>` | A list of `https://developer.android.com/reference/androidx/pdf/models/FormWidgetInfo` objects representing the form widgets of the specified types on the specified page. |

### getLinearizationStatus

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

```
abstract int getLinearizationStatus()
```

Indicates the linearization status of the document.

Value is one of the following:

- `0`
- `1`
- `2`

<br />

### getPageBitmapSource

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

```
abstract @NonNull PdfDocument.BitmapSource getPageBitmapSource(int pageNumber)
```

Gets a `https://developer.android.com/reference/androidx/pdf/PdfDocument.BitmapSource` for retrieving bitmap representations of the specified page.

| Parameters |
|---|---|
| `int pageNumber` | The page number (0-based). |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/PdfDocument.BitmapSource` | A `https://developer.android.com/reference/androidx/pdf/PdfDocument.BitmapSource` for the specified page, or null if the page number is invalid. |

### getPageContent

```
abstract PdfDocument.PdfPageContent getPageContent(int pageNumber)
```

Asynchronously retrieves the content (text and images) of the specified page.

| Parameters |
|---|---|
| `int pageNumber` | The page number (0-based). |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/pdf/PdfDocument.PdfPageContent` | A `https://developer.android.com/reference/androidx/pdf/PdfDocument.PdfPageContent` object representing the page's content. |

### getPageCount

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

```
abstract int getPageCount()
```

The total number of pages in the document.

### getPageInfo

```
abstract @NonNull PdfDocument.PageInfo getPageInfo(int pageNumber)
```

Asynchronously retrieves information about the specified page.

| Parameters |
|---|---|
| `int pageNumber` | The page number (0-based). |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/PdfDocument.PageInfo` | A `https://developer.android.com/reference/androidx/pdf/PdfDocument.PageInfo` object containing information about the page. |

### getPageInfo

```
abstract @NonNull PdfDocument.PageInfo getPageInfo(int pageNumber, long pageInfoFlags)
```

Asynchronously retrieves information about the specified page.

| Parameters |
|---|---|
| `int pageNumber` | The page number (0-based). |
| `long pageInfoFlags` | A bitmask for retrieving additional page information. Does not include any additional information by default. Value is either `0` or a combination of the following: - `0` - `1` <br /> |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/PdfDocument.PageInfo` | A `https://developer.android.com/reference/androidx/pdf/PdfDocument.PageInfo` object containing information about the page. |

### getPageInfos

```
abstract @NonNull List<@NonNull PdfDocument.PageInfo> getPageInfos(@NonNull IntRange pageRange)
```

Asynchronously retrieves information about a range of pages.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.ranges/-int-range/index.html pageRange` | The range of page numbers (0-based, inclusive). |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/PdfDocument.PageInfo>` | A list of `https://developer.android.com/reference/androidx/pdf/PdfDocument.PageInfo` objects, one for each page in the range. |

### getPageInfos

```
abstract @NonNull List<@NonNull PdfDocument.PageInfo> getPageInfos(@NonNull IntRange pageRange, long pageInfoFlags)
```

Asynchronously retrieves information about a range of pages.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.ranges/-int-range/index.html pageRange` | The range of page numbers (0-based, inclusive). |
| `long pageInfoFlags` | A bitmask for retrieving additional page information. Does not include any additional information by default. Value is either `0` or a combination of the following: - `0` - `1` <br /> |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/PdfDocument.PageInfo>` | A list of `https://developer.android.com/reference/androidx/pdf/PdfDocument.PageInfo` objects, one for each page in the range. |

### getPageLinks

```
abstract @NonNull PdfDocument.PdfPageLinks getPageLinks(int pageNumber)
```

Asynchronously retrieves the links (Go To and external) present on the specified page.

| Parameters |
|---|---|
| `int pageNumber` | The page number (0-based). |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/PdfDocument.PdfPageLinks` | A `https://developer.android.com/reference/androidx/pdf/PdfDocument.PdfPageLinks` object representing the page's links. |

### getRenderParams

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

```
abstract @NonNull RenderParams getRenderParams()
```

The render params used to determine the contents that will be rendered on the bitmap.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/pdf/RenderParams` |   |
| `https://developer.android.com/reference/androidx/pdf/PdfDocument.BitmapSource#getBitmap(android.util.Size,android.graphics.Rect)` |   |

### getSelectionBounds

```
abstract PageSelection getSelectionBounds(
    int pageNumber,
    @NonNull PointF start,
    @NonNull PointF stop
)
```

Asynchronously retrieves the selection bounds (in PDF coordinates) for the specified text selection.

| Parameters |
|---|---|
| `int pageNumber` | The page on which text to be selected. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/PointF.html start` | The starting point of the text selection. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/PointF.html stop` | The ending point of the text selection. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/pdf/content/PageSelection` | A `https://developer.android.com/reference/androidx/pdf/content/PageSelection` object representing the selection bounds on the page. |

### getUri

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

```
abstract @NonNull Uri getUri()
```

The URI of the document represented by this object

### removeOnEditAppliedListener

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

```
@ExperimentalPdfApi
default void removeOnEditAppliedListener(
    @NonNull PdfDocument.OnEditAppliedListener listener
)
```

Remove a listener for applied edits.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/PdfDocument.OnEditAppliedListener listener` | the listener for notification of applied edit. |

### removeOnPdfContentInvalidatedListener

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

```
abstract void removeOnPdfContentInvalidatedListener(
    @NonNull PdfDocument.OnPdfContentInvalidatedListener listener
)
```

Removes the listener from the list of listeners which are notified when some regions of the PDF content are invalidated.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/PdfDocument.OnPdfContentInvalidatedListener listener` | The listener to remove. |

### searchDocument

```
abstract @NonNull SparseArray<@NonNull List<@NonNull PageMatchBounds>> searchDocument(@NonNull String query, @NonNull IntRange pageRange)
```

Asynchronously searches the document for the specified query within a range of pages.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html query` | The search query string. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.ranges/-int-range/index.html pageRange` | The range of page numbers (0-based, inclusive) to search within. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/SparseArray.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/pdf/content/PageMatchBounds>>` | A `https://developer.android.com/reference/android/util/SparseArray.html` mapping page numbers to lists of `https://developer.android.com/reference/androidx/pdf/content/PageMatchBounds` objects representing the search results on each page. |