Skip to main content
KPdfViewerState exposes navigation and zoom as simple method calls, so you can wire them to any button, gesture handler, or keyboard shortcut in your UI. Gesture-based navigation and pinch-to-zoom are configured separately in KPdfViewerConfig before the viewer is created. Call nextPage, previousPage, or goToPage on the viewer state. Each call updates currentPageIndex, which KPdfViewer observes and reacts to automatically.
goToPage takes a 0-based index, so page 10 is index 9. You can read the current page at any time from the state flow:

Swipe-to-navigate

To let users swipe between pages, enable enableSwipe in your KPdfViewerConfig:
Set it to false if you want to restrict navigation to programmatic calls only.

Zoom controls

Call zoomIn, zoomOut, resetZoom, or setZoom to change the zoom level. Changes propagate to KPdfViewer through the currentZoom state flow.
To jump to a specific zoom factor, call setZoom directly:
You can also read the live zoom value:

Pinch-to-zoom and zoom range

Configure pinch-to-zoom and its limits in KPdfViewerConfig:
resetZoom resets the zoom to minZoom from the configured zoomRange. If you want a “fit page” behaviour, set minZoom to 1f (the default) and call resetZoom.