Package-level declarations

Types

Link copied to clipboard
class ComposeCanvas(drawScope: DrawScope, textMeasurer: TextMeasurer, hairlineWidthPx: Float = 1.0f, skipSystemFontText: Boolean = false) : KiteCanvas

KiteCanvas backed by a Compose Multiplatform DrawScope.

Link copied to clipboard
actual object ImageDecoder

Platform-supplied image decoder. KitePDF's core stays pure-Kotlin-stdlib; actual JPEG / PNG / etc. decoding rides on whatever the host platform already provides: Skia on Desktop, the OS framework on Android / iOS, createImageBitmap on JS.

expect object ImageDecoder

Platform-supplied image decoder. KitePDF's core stays pure-Kotlin-stdlib; actual JPEG / PNG / etc. decoding rides on whatever the host platform already provides: Skia on Desktop, the OS framework on Android / iOS, createImageBitmap on JS.

actual object ImageDecoder

Platform-supplied image decoder. KitePDF's core stays pure-Kotlin-stdlib; actual JPEG / PNG / etc. decoding rides on whatever the host platform already provides: Skia on Desktop, the OS framework on Android / iOS, createImageBitmap on JS.

actual object ImageDecoder

Platform-supplied image decoder. KitePDF's core stays pure-Kotlin-stdlib; actual JPEG / PNG / etc. decoding rides on whatever the host platform already provides: Skia on Desktop, the OS framework on Android / iOS, createImageBitmap on JS.

actual object ImageDecoder

Platform-supplied image decoder. KitePDF's core stays pure-Kotlin-stdlib; actual JPEG / PNG / etc. decoding rides on whatever the host platform already provides: Skia on Desktop, the OS framework on Android / iOS, createImageBitmap on JS.

actual object ImageDecoder

Platform-supplied image decoder. KitePDF's core stays pure-Kotlin-stdlib; actual JPEG / PNG / etc. decoding rides on whatever the host platform already provides: Skia on Desktop, the OS framework on Android / iOS, createImageBitmap on JS.

actual object ImageDecoder

Platform-supplied image decoder. KitePDF's core stays pure-Kotlin-stdlib; actual JPEG / PNG / etc. decoding rides on whatever the host platform already provides: Skia on Desktop, the OS framework on Android / iOS, createImageBitmap on JS.

Link copied to clipboard
data class PageHit(val pageIndex: Int, val x: Double, val y: Double)

A PdfViewState.hitTest result: the page under a viewport point and the point in that page's own space (PDF: user space, y-up from the display box's bottom-left with rotation unfolded; EPUB: the page's document space).

Link copied to clipboard
data class PdfHighlight(val hit: KiteSearchHit, val color: Color? = null, val edgeMarker: Boolean = false, val edgeMarkerColor: Color? = null, val edgeMarkerSide: PdfMarkerSide = PdfMarkerSide.End)

One entry of PdfViewState.highlights: where to paint (hit) plus how to paint it.

Link copied to clipboard
sealed interface PdfLayout

How PdfView lays its pages out and how the user moves between them.

Link copied to clipboard

Which page margin an edge marker is painted in.

Link copied to clipboard
class PdfRasterizer(density: Density, layoutDirection: LayoutDirection, textMeasurer: TextMeasurer)

Imperative page → ImageBitmap pipeline. This is the raster engine behind PdfView; it is public so apps with custom viewers (own pagers, thumbnail grids, PNG export jobs) don't have to re-implement the CTM/flip/hairline math themselves.

Link copied to clipboard
sealed interface PdfRenderSpec

How PdfView turns pages into pixels. Pick a variant; each carries only the knobs that actually apply to it, so there are no settings that silently do nothing. Defaults to Rasterized via PdfRenderSpec.Default.

Link copied to clipboard
Link copied to clipboard

Which end of the selection a handle marks, in reading order.

Link copied to clipboard

Draws one selection boundary marker ("thumb") for PdfView.

Link copied to clipboard

Default look of PdfSelectionMenu's built-in chrome.

Link copied to clipboard
class PdfSelectionMenuItem(val label: String, val icon: @Composable () -> Unit? = null, val clearsSelection: Boolean = true, val onClick: (TextSelection) -> Unit)

One action in a PdfSelectionMenu: a label, an optional leading icon slot, and what to do with the selected text.

Link copied to clipboard
data class PdfViewColors(val pageBackground: Color = Color.White, val viewportBackground: Color = Color.Transparent, val theme: ReaderTheme? = null, val searchHighlight: Color = Color(0x66FFEB3B), val selectionHighlight: Color = Color(0x664285F4), val selectionHandle: Color = Color(0xFF4285F4), val selectionHandlePainter: PdfSelectionHandlePainter? = null)

Colours used by PdfView.

Link copied to clipboard
class PdfViewState(val document: KiteDocument, initialPage: Int = 0)

Observable state + control surface of a PdfView.

Link copied to clipboard
data class PdfZoomSpec(val pinchEnabled: Boolean = true, val doubleTapEnabled: Boolean = true, val panEnabled: Boolean = true, val minZoom: Float = 1.0f, val maxZoom: Float = 8.0f, val doubleTapZoom: Float = 2.5f, val resetZoomOnPageChange: Boolean = true)

Zoom & pan behaviour for PdfView.

Link copied to clipboard
data class TextSelection(val pageIndex: Int, val start: Int, val end: Int, val text: String, val quads: List<Rectangle>)

A finalized or in-progress text selection on one page (cross-page selection is out of scope). start/end are INCLUSIVE flattened char indices into the page's io.github.yuroyami.kitepdf.core.KiteStructuredText reading order; text carries \n/\n\n line/block separators exactly like the extraction text; quads are display-space, one per line touched.

Functions

Link copied to clipboard

Encode this ImageBitmap to PNG bytes, the "saveable image" counterpart of PdfView's onPageRendered callback. Write the result to a file, share it, upload it; PNG is lossless so the export is pixel-identical to what was on screen.

Encode this ImageBitmap to PNG bytes, the "saveable image" counterpart of PdfView's onPageRendered callback. Write the result to a file, share it, upload it; PNG is lossless so the export is pixel-identical to what was on screen.

Encode this ImageBitmap to PNG bytes, the "saveable image" counterpart of PdfView's onPageRendered callback. Write the result to a file, share it, upload it; PNG is lossless so the export is pixel-identical to what was on screen.

Encode this ImageBitmap to PNG bytes, the "saveable image" counterpart of PdfView's onPageRendered callback. Write the result to a file, share it, upload it; PNG is lossless so the export is pixel-identical to what was on screen.

Encode this ImageBitmap to PNG bytes, the "saveable image" counterpart of PdfView's onPageRendered callback. Write the result to a file, share it, upload it; PNG is lossless so the export is pixel-identical to what was on screen.

Encode this ImageBitmap to PNG bytes, the "saveable image" counterpart of PdfView's onPageRendered callback. Write the result to a file, share it, upload it; PNG is lossless so the export is pixel-identical to what was on screen.

Encode this ImageBitmap to PNG bytes, the "saveable image" counterpart of PdfView's onPageRendered callback. Write the result to a file, share it, upload it; PNG is lossless so the export is pixel-identical to what was on screen.

Link copied to clipboard
fun EpubView(document: EpubDocument, modifier: Modifier = Modifier, page: Int? = null, background: Color = Color.White, theme: ReaderTheme? = null, pageSpacing: Dp = 8.dp, onPageRendered: (pageIndex: Int, image: ImageBitmap) -> Unit? = null, onTap: (Offset) -> Unit? = null, onLinkTap: (PdfAction) -> Boolean? = null)

Convenience viewer for a reflowed EpubDocument: opens the whole book as a continuous vertical scroll, or a single page. Delegates to the shared PdfView renderer. Pages are rasterized once per (page, size) bucket and drawn as images, exactly like PDF.

Link copied to clipboard
fun PdfNavigationControls(state: PdfViewState, modifier: Modifier = Modifier, contentColor: Color = Color.White, containerColor: Color = Color(0xB3222222), textStyle: TextStyle = TextStyle.Default)

Previous / "x of y" / next pill. Buttons auto-disable at the ends.

Link copied to clipboard
fun PdfOutlinePanel(state: PdfViewState, modifier: Modifier = Modifier, outline: List<KiteOutlineItem> = state.document.outline, contentPadding: PaddingValues = PaddingValues(8.dp), textStyle: TextStyle = TextStyle(fontSize = 14.sp), textColor: Color = Color(0xFF202124), disabledTextColor: Color = Color(0xFF9AA0A6), currentPageColor: Color = Color(0xFF4A90D9), indent: Dp = 16.dp, onNavigate: (KiteOutlineItem) -> Unit? = null)

A navigation panel over the document's outline (PDF bookmarks / EPUB table of contents): an indented, clickable column of KiteOutlineItems. Clicking an entry with a resolved page scrolls there (and calls onNavigate); entries without one (unresolvable destinations, grouping labels) render dimmed and unclickable. Plain foundation styling, like every widget here.

Link copied to clipboard
fun PdfPageIndicator(state: PdfViewState, modifier: Modifier = Modifier, textStyle: TextStyle = TextStyle.Default, format: (currentPage: Int, pageCount: Int) -> String = { c, t -> "${c + 1} / $t" })

"current / total" page readout. Recomposes as the user scrolls or swipes.

Link copied to clipboard
fun BoxScope.PdfSelectionMenu(state: PdfViewState, items: List<PdfSelectionMenuItem>, modifier: Modifier = Modifier, highlightColors: List<Color> = emptyList(), onHighlightColorPicked: (TextSelection, Color) -> Unit? = null, clearSelectionOnColorPick: Boolean = true, alignment: Alignment = Alignment.TopCenter, showWhileSelecting: Boolean = false, containerColor: Color = PdfSelectionMenuDefaults.ContainerColor, contentColor: Color = PdfSelectionMenuDefaults.ContentColor, container: @Composable (selection: TextSelection, content: @Composable () -> Unit) -> Unit? = null, itemContent: @Composable (item: PdfSelectionMenuItem, selection: TextSelection) -> Unit? = null, colorSwatch: @Composable (color: Color, onPick: () -> Unit) -> Unit? = null)

The selection context menu: place it in PdfView's overlay slot and it appears whenever text is selected, listing items and, when highlightColors is non-empty, a wrapping row of colour swatches.

Link copied to clipboard
fun PdfThumbnailStrip(state: PdfViewState, modifier: Modifier = Modifier, thumbnailHeight: Dp = 72.dp, spacing: Dp = 8.dp, contentPadding: PaddingValues = PaddingValues(8.dp), selectedBorderColor: Color = Color(0xFF4A90D9), pageBackground: Color = Color.White)

Horizontal strip of tappable page thumbnails; the current page is outlined. Tapping a thumbnail animates the PdfView sharing this state to that page.

Link copied to clipboard
fun PdfView(document: PdfDocument, modifier: Modifier = Modifier, page: Int? = null, background: Color = Color.White, pageSpacing: Dp = 8.dp, onPageRendered: (pageIndex: Int, image: ImageBitmap) -> Unit? = null, onTap: (Offset) -> Unit? = null, onLinkTap: (PdfAction) -> Boolean? = null)

Convenience entry point: remembers its own state internally.

fun PdfView(state: PdfViewState, modifier: Modifier = Modifier, layout: PdfLayout = PdfLayout.Default, zoomSpec: PdfZoomSpec = PdfZoomSpec(), renderSpec: PdfRenderSpec = PdfRenderSpec.Default, colors: PdfViewColors = PdfViewColors(), pageSpacing: Dp = 8.dp, userScrollEnabled: Boolean = true, onPageRendered: (pageIndex: Int, image: ImageBitmap) -> Unit? = null, pagePlaceholder: @Composable (pageIndex: Int) -> Unit? = null, overlay: @Composable BoxScope.(PdfViewState) -> Unit? = null, onTap: (Offset) -> Unit? = null, onLinkTap: (PdfAction) -> Boolean? = null)

THE KitePDF viewer composable.

Link copied to clipboard

Remembers a PdfViewState for an EPUB document. Hoist it to drive an EpubView (or the shared PdfView state overload) from navigation buttons, a page indicator, a HUD. The state object is the single point of control.

Link copied to clipboard

PdfRasterizer wired to the composition's density, layout direction and font resolver.

Link copied to clipboard
fun rememberPdfViewState(document: PdfDocument, initialPage: Int = 0): PdfViewState

Remembers a PdfViewState for document. Hoist it to drive a PdfView from anywhere: navigation buttons in your top bar, a zoom slider, a HUD overlay. The state object is the single point of control.