Documentation Index
Fetch the complete documentation index at: https://mahmoud-b28887f9.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
KPdfViewer is the primary composable for displaying a PDF document. It reads the current rendered page and zoom level from a KPdfViewerState instance and paints that page inside a rounded Card surface styled with your app’s MaterialTheme colors. You pass in state — KPdfViewer handles everything else.
Signature
Parameters
The shared state holder for the viewer.
KPdfViewer collects state.renderedPage as a Compose state and recomposes whenever the active page or zoom level changes. Create this with rememberPdfViewerState in a Composable context.Standard Compose modifier applied to the outer
Card. Use it to set the size, padding, or weight of the viewer surface.Visual behavior
KPdfViewer wraps the page content in a Material3 Card with:
- Shape —
RoundedCornerShape(24.dp)on all corners. - Border — 1 dp stroke using
MaterialTheme.colorScheme.outlineVariant. - Background —
MaterialTheme.colorScheme.surface.
KPdfContent composable fills the card completely and delegates gesture handling, panning, and zoom rendering to the state.
KPdfViewer does not control navigation or zoom directly. Call methods such as state.nextPage(), state.zoomIn(), or state.goToPage(index) on KPdfViewerState to drive the viewer.Minimal usage
Create aKPdfViewerState with rememberPdfViewerState, then pass it to KPdfViewer.
Usage with a modifier
Usemodifier to size KPdfViewer within a layout. The example below makes the viewer fill all remaining vertical space inside a Column.
Connecting to a toolbar and thumbnail strip
KPdfViewer, KPdfViewerToolbar, and KPdfThumbnailStrip all share the same KPdfViewerState. Pass the same instance to each composable — no additional wiring is required.