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.
KPdfViewerConfig controls runtime behavior for a single KPDF viewer instance: how the user interacts with pages through gestures, how aggressively the SDK caches rendered pages in RAM and on disk, and how many pages to preload in the background. Build a config once, hold it stable in a remember block, and pass it to rememberPdfViewerState.
Builder options
enableZoom — Boolean, default true
enableZoom — Boolean, default true
Enable or disable pinch-to-zoom and double-tap zoom on the page surface.
enableSwipe — Boolean, default true
enableSwipe — Boolean, default true
Allow horizontal swipe gestures to navigate between pages when the viewer is at its base zoom level. Disable this if you want to control navigation exclusively through buttons or your own gesture recognizers.
zoomRange — Float range, default 1f..4f
zoomRange — Float range, default 1f..4f
Set the minimum and maximum zoom factors for pinch and double-tap zoom.
minZoom must be greater than 0 and maxZoom must be greater than or equal to minZoom.doubleTapZoom — Float, default 2f
doubleTapZoom — Float, default 2f
Set the zoom level applied when the user double-taps a page. The SDK clamps this value to the configured zoom range at build time. Must be greater than
0.ramCacheSize — Int (pages), default 6
ramCacheSize — Int (pages), default 6
Set the maximum number of rendered page bitmaps held in RAM for this viewer. Larger values make page turns smoother at the cost of memory. Pass
0 to disable the in-memory cache entirely.diskCacheSize — Int (pages), default 24
diskCacheSize — Int (pages), default 24
Set the maximum number of rendered pages persisted to disk. Disk caching lets the viewer restore pages quickly after they are evicted from RAM. Pass
0 to disable disk caching.preloadPageCount — Int (pages), default 0
preloadPageCount — Int (pages), default 0
Set how many pages adjacent to the current page the SDK renders in the background. For example, a value of
2 prerenders 2 pages ahead and 2 behind. Pass 0 to disable background preloading.Using the builder
CallKPdfViewerConfig.builder(), chain the options you want to override, then call build():
Using the DSL
ThepdfViewerConfig {} extension is a Kotlin-idiomatic alternative to the builder. It accepts the same Builder receiver, so every option works identically:
Passing config to the viewer
Default values at a glance
| Option | Default |
|---|---|
enableZoom | true |
enableSwipe | true |
zoomRange | 1f..4f |
doubleTapZoom | 2f |
ramCacheSize | 6 pages |
diskCacheSize | 24 pages |
preloadPageCount | 0 (disabled) |