# PdfViewer

## Functions summary

|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable @https://developer.android.com/reference/kotlin/androidx/pdf/ExperimentalPdfApi https://developer.android.com/reference/kotlin/androidx/pdf/compose/PdfViewer.composable#PdfViewer(androidx.pdf.PdfDocument,androidx.pdf.compose.PdfViewerState,androidx.compose.ui.Modifier,kotlin.Boolean,kotlin.Boolean,androidx.pdf.ocr.OcrProvider,kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Int,androidx.compose.ui.unit.Dp,androidx.compose.ui.unit.Dp,androidx.pdf.compose.FastScrollConfiguration,androidx.compose.foundation.layout.PaddingValues,kotlin.Function1,kotlin.Function1,kotlin.Function1,kotlin.Function0,kotlin.Function1)( pdfDocument: https://developer.android.com/reference/kotlin/androidx/pdf/PdfDocument?, state: https://developer.android.com/reference/kotlin/androidx/pdf/compose/PdfViewerState, modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier, isFormFillingEnabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, isImageSelectionEnabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, ocrProvider: https://developer.android.com/reference/kotlin/androidx/pdf/ocr/OcrProvider?, minZoom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, maxZoom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, verticalAlignment: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, pagesPerRow: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, horizontalPageSpacing: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp, verticalPageSpacing: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp, fastScrollConfig: https://developer.android.com/reference/kotlin/androidx/pdf/compose/FastScrollConfiguration, contentPadding: https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/PaddingValues, appendContextMenuComponents: (https://developer.android.com/reference/kotlin/androidx/pdf/compose/PdfSelectionMenuBuilderScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?, filterContextMenuComponents: ((https://developer.android.com/reference/kotlin/androidx/pdf/selection/ContextMenuComponent) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)?, onFormWidgetInfoUpdated: ((https://developer.android.com/reference/kotlin/androidx/pdf/models/FormEditInfo) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?, onFirstContentLoad: (() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)?, onUrlLinkClicked: ((https://developer.android.com/reference/android/net/Uri.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)? )` A `https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable` that presents PDF content, provided as `https://developer.android.com/reference/kotlin/androidx/pdf/PdfDocument` |

## Functions

### PdfViewer

Artifact: [androidx.pdf:pdf-compose](https://developer.android.com/jetpack/androidx/releases/pdf) [View Source](https://cs.android.com/search?q=file:androidx/pdf/compose/PdfViewer.kt+function:PdfViewer)

```
@Composable
@ExperimentalPdfApi
fun PdfViewer(
    pdfDocument: PdfDocument?,
    state: PdfViewerState,
    modifier: Modifier = Modifier,
    isFormFillingEnabled: Boolean = false,
    isImageSelectionEnabled: Boolean = false,
    ocrProvider: OcrProvider? = null,
    minZoom: Float = PdfView.MIN_PERMISSIBLE_ZOOM,
    maxZoom: Float = PdfView.MAX_PERMISSIBLE_ZOOM,
    verticalAlignment: Int = PdfView.VERTICAL_ALIGNMENT_CENTER,
    pagesPerRow: Int = PdfView.SINGLE_PAGE,
    horizontalPageSpacing: Dp = 8.dp,
    verticalPageSpacing: Dp = 8.dp,
    fastScrollConfig: FastScrollConfiguration = FastScrollConfiguration.withDrawableAndDimensionIds(),
    contentPadding: PaddingValues = NoPadding,
    appendContextMenuComponents: (PdfSelectionMenuBuilderScope.() -> Unit)? = null,
    filterContextMenuComponents: ((ContextMenuComponent) -> Boolean)? = null,
    onFormWidgetInfoUpdated: ((FormEditInfo) -> Unit)? = null,
    onFirstContentLoad: (() -> Unit)? = null,
    onUrlLinkClicked: ((Uri) -> Boolean)? = null
): Unit
```

A `https://developer.android.com/reference/kotlin/androidx/compose/runtime/Composable` that presents PDF content, provided as `https://developer.android.com/reference/kotlin/androidx/pdf/PdfDocument`

| Parameters |
|---|---|
| `pdfDocument: https://developer.android.com/reference/kotlin/androidx/pdf/PdfDocument?` | the PDF content to present, If no document is provided, the viewer will remain empty |
| `state: https://developer.android.com/reference/kotlin/androidx/pdf/compose/PdfViewerState` | the state object used to observe and control content position |
| `modifier: https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier = Modifier` | the `https://developer.android.com/reference/kotlin/androidx/compose/ui/Modifier` to be applied to this PDF viewer |
| `isFormFillingEnabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = false` | boolean flag to enable / disable the form-filling feature surface. |
| `isImageSelectionEnabled: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html = false` | boolean flag to enable / disable the image-selection feature surface. |
| `ocrProvider: https://developer.android.com/reference/kotlin/androidx/pdf/ocr/OcrProvider? = null` | an `https://developer.android.com/reference/kotlin/androidx/pdf/ocr/OcrProvider` instance to be used for OCR (Optical Character Recognition) in image PDF content. The caller retains ownership of the `https://developer.android.com/reference/kotlin/androidx/pdf/ocr/OcrProvider` and is responsible for calling `https://developer.android.com/reference/kotlin/androidx/pdf/ocr/OcrProvider#close()` when it is no longer needed. |
| `minZoom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = PdfView.MIN_PERMISSIBLE_ZOOM` | the minimum zoom / scaling factor that can be applied to the PDF viewer |
| `maxZoom: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html = PdfView.MAX_PERMISSIBLE_ZOOM` | the maximum zoom / scaling factor that can be applied to the PDF viewer |
| `verticalAlignment: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = PdfView.VERTICAL_ALIGNMENT_CENTER` | the alignment of the top page within the view |
| `pagesPerRow: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html = PdfView.SINGLE_PAGE` | The number of pages to display in a single row. |
| `horizontalPageSpacing: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp = 8.dp` | The spacing between horizontally adjacent pages. |
| `verticalPageSpacing: https://developer.android.com/reference/kotlin/androidx/compose/ui/unit/Dp = 8.dp` | The spacing between vertically adjacent pages. |
| `fastScrollConfig: https://developer.android.com/reference/kotlin/androidx/pdf/compose/FastScrollConfiguration = FastScrollConfiguration.withDrawableAndDimensionIds()` | a `https://developer.android.com/reference/kotlin/androidx/pdf/compose/FastScrollConfiguration` instance to customize the fast scroller's appearance |
| `contentPadding: https://developer.android.com/reference/kotlin/androidx/compose/foundation/layout/PaddingValues = NoPadding` | a padding around the whole content. This will add padding for the content after it has been clipped, which is not possible via `https://developer.android.com/reference/kotlin/androidx/pdf/compose/package-summary#PdfViewer(androidx.pdf.PdfDocument,androidx.pdf.compose.PdfViewerState,androidx.compose.ui.Modifier,kotlin.Boolean,kotlin.Boolean,androidx.pdf.ocr.OcrProvider,kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Int,androidx.compose.ui.unit.Dp,androidx.compose.ui.unit.Dp,androidx.pdf.compose.FastScrollConfiguration,androidx.compose.foundation.layout.PaddingValues,kotlin.Function1,kotlin.Function1,kotlin.Function1,kotlin.Function0,kotlin.Function1)` param. Note: The content bleeds into the padded area when the view is scrolled. |
| `appendContextMenuComponents: (https://developer.android.com/reference/kotlin/androidx/pdf/compose/PdfSelectionMenuBuilderScope.() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | a callback that can be used to add context menu items. |
| `filterContextMenuComponents: ((https://developer.android.com/reference/kotlin/androidx/pdf/selection/ContextMenuComponent) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)? = null` | a callback that can be used to filter context menu items. This will be executed on the complete list of menu items after `https://developer.android.com/reference/kotlin/androidx/pdf/compose/package-summary#PdfViewer(androidx.pdf.PdfDocument,androidx.pdf.compose.PdfViewerState,androidx.compose.ui.Modifier,kotlin.Boolean,kotlin.Boolean,androidx.pdf.ocr.OcrProvider,kotlin.Float,kotlin.Float,kotlin.Int,kotlin.Int,androidx.compose.ui.unit.Dp,androidx.compose.ui.unit.Dp,androidx.pdf.compose.FastScrollConfiguration,androidx.compose.foundation.layout.PaddingValues,kotlin.Function1,kotlin.Function1,kotlin.Function1,kotlin.Function0,kotlin.Function1)` is completed. |
| `onFormWidgetInfoUpdated: ((https://developer.android.com/reference/kotlin/androidx/pdf/models/FormEditInfo) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | a callback to be invoked when a form widget is updated due to a user interaction. @see `https://developer.android.com/reference/kotlin/androidx/pdf/view/PdfView.OnFormWidgetInfoUpdatedListener` |
| `onFirstContentLoad: (() -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)? = null` | a callback that is invoked when the document's content is first loaded It resets and trigger again if a new document is loaded or if the underlying view is recreated. |
| `onUrlLinkClicked: ((https://developer.android.com/reference/android/net/Uri.html) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)? = null` | a callback to be invoked when the user taps a URL link in this PDF viewer |