# PdfViewportState

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

*** ** * ** ***


```
public final class PdfViewportState
```

<br />

*** ** * ** ***

Represents the state of the viewport on which `https://developer.android.com/reference/androidx/pdf/view/PdfView` is overlaid.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/pdf/annotation/PdfViewportState#PdfViewportState(kotlin.Int,kotlin.Int,android.util.SparseArray,kotlin.Float)( int firstVisiblePage, int visiblePagesCount, @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/android/graphics/RectF.html> pageBounds, float zoom )` |

| ### Public methods |
|---|---|
| `final int` | `https://developer.android.com/reference/androidx/pdf/annotation/PdfViewportState#getFirstVisiblePage()()` The index of the first visible page 0-based. |
| `final @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/android/graphics/RectF.html>` | `https://developer.android.com/reference/androidx/pdf/annotation/PdfViewportState#getPageBounds()()` A mapping of page numbers to their bounds in view coordinates. |
| `final int` | `https://developer.android.com/reference/androidx/pdf/annotation/PdfViewportState#getVisiblePagesCount()()` The number of currently visible pages. |
| `final float` | `https://developer.android.com/reference/androidx/pdf/annotation/PdfViewportState#getZoom()()` The current zoom level of the PDF. |

## Public constructors

### PdfViewportState

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

```
public PdfViewportState(
    int firstVisiblePage,
    int visiblePagesCount,
    @NonNull SparseArray<@NonNull RectF> pageBounds,
    float zoom
)
```

| Parameters |
|---|---|
| `int firstVisiblePage` | The index of the first visible page 0-based. |
| `int visiblePagesCount` | The number of currently visible pages. |
| `@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/android/graphics/RectF.html> pageBounds` | A mapping of page numbers to their bounds in view coordinates. |
| `float zoom` | The current zoom level of the PDF. |

## Public methods

### getFirstVisiblePage

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

```
public final int getFirstVisiblePage()
```

The index of the first visible page 0-based.

### getPageBounds

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

```
public final @NonNull SparseArray<@NonNull RectF> getPageBounds()
```

A mapping of page numbers to their bounds in view coordinates.

### getVisiblePagesCount

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

```
public final int getVisiblePagesCount()
```

The number of currently visible pages.

### getZoom

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

```
public final float getZoom()
```

The current zoom level of the PDF.