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 is an immutable configuration object that controls the runtime behavior of a single KPdfViewerState instance. You construct it through a builder or a Kotlin DSL, then pass it to rememberPdfViewerState or KPdf.viewerState. Configuration is fixed for the lifetime of the viewer state — to change behavior, create a new KPdfViewerState with updated config.
Builder pattern
CallKPdfViewerConfig.builder() to get a mutable Builder, chain the methods you need, and call build() to produce the immutable config.
DSL pattern
ThepdfViewerConfig {} top-level extension function wraps the builder in a Kotlin DSL block. It is equivalent to the builder pattern and produces the same KPdfViewerConfig type.
Builder methods
Enables or disables pinch-to-zoom on the PDF page surface. When
false, the viewer locks at the minimum zoom level and ignores pinch gestures.Enables horizontal swipe to navigate between pages when the viewer is at its base (minimum) zoom level. When
false, swipe gestures are ignored and you must call nextPage(), previousPage(), or goToPage() programmatically.Sets the inclusive pinch-zoom range.
minZoom must be greater than 0. maxZoom must be greater than or equal to minZoom. Throws IllegalArgumentException if either constraint is violated.The doubleTapZoom value is coerced into this range at build() time, so you do not need to ensure they are consistent manually.The zoom level applied when the user double-taps the page surface. Must be greater than
0. At build() time the value is coerced into the configured zoomRange, so it is safe to specify a value outside that range — it will be clamped automatically.The maximum number of rendered pages the SDK holds in memory at one time for this viewer instance. A larger value reduces re-render latency when navigating back and forth through pages at the cost of higher memory usage. Set to
0 to disable the in-memory cache entirely.Must be >= 0.The maximum number of rendered pages the SDK stores on disk for this viewer instance. A larger value keeps more pages available after they are evicted from RAM, at the cost of additional disk I/O and storage. Set to
0 to disable the disk cache entirely.Must be >= 0.The number of pages to render in the background on either side of the current page. For example, a value of
1 preloads one page ahead and one page behind. Set to 0 to disable background preloading. Increasing this value can make page transitions feel instantaneous but raises CPU and memory usage.Must be >= 0.Default constants
The following compile-time constants are available on the companion object if you want to reference the defaults explicitly:| Constant | Value |
|---|---|
KPdfViewerConfig.DefaultRamCacheSize | 6 |
KPdfViewerConfig.DefaultDiskCacheSize | 24 |