androidx.pdf.compose

Provides @Composables for presenting PDF content

Interfaces

PdfZoomScrollScope

Scope used for suspending scroll blocks

Classes

FastScrollConfiguration

Value class describing visual customization to the fast scrolling affordance.

PdfViewerState

A state object that can be hoisted to observe and control PdfViewer zoom, scroll, and content position.

Top-level functions summary

Unit
@Composable
PdfViewer(
    pdfDocument: PdfDocument?,
    state: PdfViewerState,
    modifier: Modifier,
    minZoom: Float,
    maxZoom: Float,
    fastScrollConfig: FastScrollConfiguration,
    onUrlLinkClicked: ((Uri) -> Boolean)?
)

A Composable that presents PDF content, provided as PdfDocument

Top-level functions

PdfViewer

@Composable
fun PdfViewer(
    pdfDocument: PdfDocument?,
    state: PdfViewerState,
    modifier: Modifier = Modifier,
    minZoom: Float = PdfView.DEFAULT_MIN_ZOOM,
    maxZoom: Float = PdfView.DEFAULT_MAX_ZOOM,
    fastScrollConfig: FastScrollConfiguration = FastScrollConfiguration.withDrawableAndDimensionIds(),
    onUrlLinkClicked: ((Uri) -> Boolean)? = null
): Unit

A Composable that presents PDF content, provided as PdfDocument

Parameters
pdfDocument: PdfDocument?

the PDF content to present

state: PdfViewerState

the state object used to observe and control content position

modifier: Modifier = Modifier

the Modifier to be applied to this PDF viewer

minZoom: Float = PdfView.DEFAULT_MIN_ZOOM

the minimum zoom / scaling factor that can be applied to the PDF viewer

maxZoom: Float = PdfView.DEFAULT_MAX_ZOOM

the maximum zoom / scaling factor that can be applied to the PDF viewer

fastScrollConfig: FastScrollConfiguration = FastScrollConfiguration.withDrawableAndDimensionIds()

a FastScrollConfiguration instance to customize the fast scoller's appearance

onUrlLinkClicked: ((Uri) -> Boolean)? = null

a callback to be invoked when the user taps a URL link in this PDF viewer