KPdfViewerState.
Quick Start
Display your first PDF in under five minutes with a minimal working example.
Installation
Add the Gradle dependencies and configure your project for Android and iOS.
PDF Sources
Load PDFs from remote URLs, raw bytes, or Base64-encoded strings.
API Reference
Browse the full public API: viewer state, config, sources, and state types.
How KPDF works
KPDF is split into two modules that work together:kpdf-core— The shared PDF engine: source loading, page rendering, RAM and disk caching, navigation, zoom, save/export, and device file picker state.kpdf-compose— Compose Multiplatform UI components and platform integrations for save and open flows.
Create a PDF source
Choose
KPdfSource.Url, KPdfSource.Bytes, or KPdfSource.Base64 based on where your PDF comes from.Create viewer state
Call
rememberPdfViewerState(source, config) inside your composable to get a KPdfViewerState.Key features
Multi-source loading
Load PDFs from HTTPS URLs with custom headers, raw byte arrays, or Base64 strings — including data URL format.
Smart caching
Configurable RAM and disk page caches keep scrolling smooth and allow offline reopening of remote documents.
Save & export
Built-in save flow launches the platform file picker. Export raw bytes for custom share flows.
Connected views
Toolbar and thumbnail strip components share the same viewer state — no manual wiring required.