Package-level declarations

Types

Link copied to clipboard
actual object KmpPdfLauncher

Android implementation of the imperative launcher. Each open(...) builds an Intent targeting KmpPdfViewerHostActivity, stuffs the payload into either a primitive extra (URI / small byte arrays) or a KmpPdfLauncherRegistry token, serialises the KmpPdfLaunchOptions bundle into Intent extras alongside it, and starts the activity using the application context the library captured at startup via ViewerContextInitializer.

expect object KmpPdfLauncher

Imperative counterpart of KmpPdfViewer.

actual object KmpPdfLauncher

iOS implementation of the imperative launcher.

actual object KmpPdfLauncher

JVM / Desktop implementation of the imperative launcher.

Link copied to clipboard
sealed interface PdfPageCacheStrategy

Controls how many rasterised page bitmaps the viewer keeps in memory while scrolling, and how aggressively it prefetches pages around the viewport.

Link copied to clipboard

How PdfViewer / KmpPdfViewer arranges pages in the scrollable list.

Link copied to clipboard
fun interface PdfPrintAction

Action that hands a PDF off to the host platform's native print pipeline.

Link copied to clipboard
fun interface PdfSaveAction

Action that persists a PDF to a user-visible location on the device.

Link copied to clipboard
data class PdfSearchHighlight(val pageIndex: Int, val xPoints: Float, val yPoints: Float, val widthPoints: Float, val heightPoints: Float)

One matched substring inside a PDF page, expressed in the same coordinate system as PdfTextRun (PDF points, top-left origin).

Link copied to clipboard
fun interface PdfShareAction

Action that hands a PDF off to the host platform's native share sheet.

Link copied to clipboard
sealed interface PdfSource

Unified, sealed description of where a PDF comes from.

Link copied to clipboard

How a PdfViewerTopBar title behaves when it is too long to fit the space the bar can give it without pushing the action icons out of the way.

Link copied to clipboard
fun interface PdfUrlLauncher

Action that opens an HTTP/HTTPS URL in the platform's default browser. Returned by rememberPdfUrlLauncher and invoked from the hyperlink overlay rendered on top of selected PDF pages — see PdfViewer's hyperlinksEnabled parameter.

Link copied to clipboard
data class PdfViewerAnnotation(val pageIndex: Int, val x: Float, val y: Float, val width: Float, val height: Float, val color: Color = DefaultHighlightColor)

One in-viewer highlight annotation, expressed in the same coordinate system as com.conamobile.pdfkmp.text.PdfTextRun and PdfSearchHighlight — PDF points, top-left origin, Y growing downward — so a highlight scales with pinch zoom exactly like a search-match rectangle does.

Link copied to clipboard

Why a PdfViewer / KmpPdfViewer could not open a document, surfaced to the host via the onDocumentError callback and used internally to pick the inline error message instead of crashing.

Properties

Link copied to clipboard

Material 3 "download" / "save" icon expressed as an inline ImageVector for the same reason as PdfShareIcon — keeps the library free of compose-material-icons-extended.

Link copied to clipboard

Material 3 "share" icon expressed as an inline ImageVector so the library does not need a transitive dependency on compose-material-icons-extended — that artifact alone adds tens of thousands of vectors and noticeably inflates consumer bundle sizes.

Functions

Link copied to clipboard
fun bookPagePairs(pageCount: Int): List<List<Int>>

Computes the row layout for PdfPageLayout.TwoPageBook given a page count: a list of rows, each holding the zero-based page indices shown on that row.

Link copied to clipboard
fun buildAnnotationFromDrag(pageIndex: Int, startX: Float, startY: Float, endX: Float, endY: Float, pageWidth: Float, pageHeight: Float, color: Color = PdfViewerAnnotation.DefaultHighlightColor): PdfViewerAnnotation?

Builds a normalised PdfViewerAnnotation from a drag in page-point space, given the two opposite corners (startX/startYendX/endY). The corners are normalised so a drag in any direction (up-left, down-right, …) yields a box with non-negative width/height, and the result is clamped to the page bounds (pageWidth × pageHeight) so a highlight can never spill outside the page.

Link copied to clipboard
fun hitTestAnnotation(annotations: List<PdfViewerAnnotation>, pageIndex: Int, xPoints: Float, yPoints: Float): Int

Returns the index of the topmost annotation in annotations whose box contains the point (xPoints, yPoints) on page pageIndex, or -1 if the tap missed every annotation on that page.

Link copied to clipboard
fun KmpPdfViewer(document: <Error class: unknown class>, modifier: Modifier = Modifier, title: String = "Document", fileName: String = "document.pdf", onBack: () -> Unit? = null, backLabel: String? = null, titleOverflow: PdfTopBarTitleOverflow = PdfTopBarTitleOverflow.Ellipsis, showTopBar: Boolean = true, showBack: Boolean = onBack != null, showSearch: Boolean = true, showShare: Boolean = true, showPrint: Boolean = false, showDownload: Boolean = true, invertColors: Boolean = false, showPageIndicator: Boolean = true, zoomEnabled: Boolean = true, doubleTapToZoom: Boolean = true, showZoomControls: Boolean = true, textSelectable: Boolean = true, hyperlinksEnabled: Boolean = true, showAnnotationTools: Boolean = false, initialAnnotations: List<PdfViewerAnnotation> = emptyList(), onAnnotationsChanged: (List<PdfViewerAnnotation>) -> Unit? = null, pageLayout: PdfPageLayout = PdfPageLayout.Single, password: String? = null, onDocumentError: (PdfViewerError) -> Unit? = null, backgroundColor: Color = MaterialTheme.colorScheme.surfaceContainerLow, pageBackgroundColor: Color = Color.White, contentPadding: PaddingValues = PaddingValues(0.dp), pageSpacing: Dp = 4.dp, renderDensity: Float = pdfViewerDefaultRenderDensity, maxZoom: Float = 5.0f, cacheStrategy: PdfPageCacheStrategy = PdfPageCacheStrategy.Auto)

PdfDocument-flavoured overload — wraps the document in a PdfSource.Document and forwards. Recommended entry point when the PDF was authored through the PdfKmp DSL because text selection and hyperlinks light up automatically.

fun KmpPdfViewer(source: PdfSource, modifier: Modifier = Modifier, title: String = "Document", fileName: String = "document.pdf", onBack: () -> Unit? = null, backLabel: String? = null, titleOverflow: PdfTopBarTitleOverflow = PdfTopBarTitleOverflow.Ellipsis, showTopBar: Boolean = true, showBack: Boolean = onBack != null, showSearch: Boolean = true, showShare: Boolean = true, showPrint: Boolean = false, showDownload: Boolean = true, invertColors: Boolean = false, showPageIndicator: Boolean = true, zoomEnabled: Boolean = true, doubleTapToZoom: Boolean = true, showZoomControls: Boolean = true, textSelectable: Boolean = true, hyperlinksEnabled: Boolean = true, showAnnotationTools: Boolean = false, initialAnnotations: List<PdfViewerAnnotation> = emptyList(), onAnnotationsChanged: (List<PdfViewerAnnotation>) -> Unit? = null, pageLayout: PdfPageLayout = PdfPageLayout.Single, password: String? = null, onDocumentError: (PdfViewerError) -> Unit? = null, backgroundColor: Color = MaterialTheme.colorScheme.surfaceContainerLow, pageBackgroundColor: Color = Color.White, contentPadding: PaddingValues = PaddingValues(0.dp), pageSpacing: Dp = 4.dp, renderDensity: Float = pdfViewerDefaultRenderDensity, maxZoom: Float = 5.0f, cacheStrategy: PdfPageCacheStrategy = PdfPageCacheStrategy.Auto)

All-in-one PDF viewer screen — recommended composable entry.

fun KmpPdfViewer(bytes: ByteArray, modifier: Modifier = Modifier, title: String = "Document", fileName: String = "document.pdf", onBack: () -> Unit? = null, backLabel: String? = null, titleOverflow: PdfTopBarTitleOverflow = PdfTopBarTitleOverflow.Ellipsis, showTopBar: Boolean = true, showBack: Boolean = onBack != null, showSearch: Boolean = true, showShare: Boolean = true, showPrint: Boolean = false, showDownload: Boolean = true, invertColors: Boolean = false, showPageIndicator: Boolean = true, zoomEnabled: Boolean = true, doubleTapToZoom: Boolean = true, showZoomControls: Boolean = true, textSelectable: Boolean = true, hyperlinksEnabled: Boolean = true, showAnnotationTools: Boolean = false, initialAnnotations: List<PdfViewerAnnotation> = emptyList(), onAnnotationsChanged: (List<PdfViewerAnnotation>) -> Unit? = null, pageLayout: PdfPageLayout = PdfPageLayout.Single, password: String? = null, onDocumentError: (PdfViewerError) -> Unit? = null, backgroundColor: Color = MaterialTheme.colorScheme.surfaceContainerLow, pageBackgroundColor: Color = Color.White, contentPadding: PaddingValues = PaddingValues(0.dp), pageSpacing: Dp = 4.dp, renderDensity: Float = pdfViewerDefaultRenderDensity, maxZoom: Float = 5.0f, cacheStrategy: PdfPageCacheStrategy = PdfPageCacheStrategy.Auto)

Raw-bytes overload — for payloads that came from disk, the network, an ACTION_OPEN_DOCUMENT picker, or any other source. Text selection + hyperlink layers are inert because the bytes carry no position metadata; everything else (zoom, share, save, page indicator) works exactly the same.

fun KmpPdfViewer(uri: String, modifier: Modifier = Modifier, title: String = "Document", fileName: String = "document.pdf", onBack: () -> Unit? = null, backLabel: String? = null, titleOverflow: PdfTopBarTitleOverflow = PdfTopBarTitleOverflow.Ellipsis, showTopBar: Boolean = true, showBack: Boolean = onBack != null, showSearch: Boolean = true, showShare: Boolean = true, showPrint: Boolean = false, showDownload: Boolean = true, invertColors: Boolean = false, showPageIndicator: Boolean = true, zoomEnabled: Boolean = true, doubleTapToZoom: Boolean = true, showZoomControls: Boolean = true, textSelectable: Boolean = true, hyperlinksEnabled: Boolean = true, showAnnotationTools: Boolean = false, initialAnnotations: List<PdfViewerAnnotation> = emptyList(), onAnnotationsChanged: (List<PdfViewerAnnotation>) -> Unit? = null, pageLayout: PdfPageLayout = PdfPageLayout.Single, password: String? = null, onDocumentError: (PdfViewerError) -> Unit? = null, backgroundColor: Color = MaterialTheme.colorScheme.surfaceContainerLow, pageBackgroundColor: Color = Color.White, contentPadding: PaddingValues = PaddingValues(0.dp), pageSpacing: Dp = 4.dp, renderDensity: Float = pdfViewerDefaultRenderDensity, maxZoom: Float = 5.0f, cacheStrategy: PdfPageCacheStrategy = PdfPageCacheStrategy.Auto)

String-URI overload, deprecated in favour of PdfSource.auto.

Link copied to clipboard
fun PdfSaveFab(document: <Error class: unknown class>, fileName: String = "document.pdf", modifier: Modifier = Modifier, containerColor: Color = MaterialTheme.colorScheme.secondaryContainer, contentColor: Color = MaterialTheme.colorScheme.onSecondaryContainer)

PdfDocument-flavoured overload of PdfSaveFab.

fun PdfSaveFab(bytes: ByteArray, fileName: String = "document.pdf", modifier: Modifier = Modifier, containerColor: Color = MaterialTheme.colorScheme.secondaryContainer, contentColor: Color = MaterialTheme.colorScheme.onSecondaryContainer)

Material 3 FloatingActionButton that persists bytes to the user-visible Downloads folder via rememberPdfSaveAction. Same placement story as PdfShareFab — host it in PdfViewer's overlay slot or anywhere a FloatingActionButton fits.

Link copied to clipboard
fun PdfSearchBar(query: String, onQueryChange: (String) -> Unit, matchCount: Int, activeIndex: Int, onPrevious: () -> Unit, onNext: () -> Unit, onClose: () -> Unit, modifier: Modifier = Modifier, placeholder: String = "Search in document")

Inline search field that morphs into the place of PdfViewerTopBar while the user is searching the document. Mirrors the handoff's "Topbar → search transition" behaviour: same height as the parent topbar, white background, divider underneath, focus-on-mount, with prev / next / close affordances and a live match counter.

Link copied to clipboard
fun PdfShareFab(document: <Error class: unknown class>, fileName: String = "document.pdf", modifier: Modifier = Modifier, containerColor: Color = MaterialTheme.colorScheme.primaryContainer, contentColor: Color = MaterialTheme.colorScheme.onPrimaryContainer)

PdfDocument-flavoured overload — defers the PdfDocument.toByteArray call to the click handler so re-renders don't allocate. Pair with PdfViewer's overlay slot for a one-line setup:

fun PdfShareFab(bytes: ByteArray, fileName: String = "document.pdf", modifier: Modifier = Modifier, containerColor: Color = MaterialTheme.colorScheme.primaryContainer, contentColor: Color = MaterialTheme.colorScheme.onPrimaryContainer)

Material 3 FloatingActionButton that hands bytes off to the platform share sheet via rememberPdfShareAction.

Link copied to clipboard
fun PdfViewer(bytes: ByteArray, modifier: Modifier = Modifier, showShareButton: Boolean = true, shareFileName: String = "document.pdf", backgroundColor: Color = MaterialTheme.colorScheme.surfaceContainerLow, pageBackgroundColor: Color = Color.White, contentPadding: PaddingValues = PaddingValues(0.dp), pageSpacing: Dp = 4.dp, renderDensity: Float = pdfViewerDefaultRenderDensity, maxZoom: Float = DEFAULT_MAX_ZOOM, zoomEnabled: Boolean = true, doubleTapToZoom: Boolean = true, showZoomControls: Boolean = true, invertColors: Boolean = false, showPageIndicator: Boolean = true, pageLayout: PdfPageLayout = PdfPageLayout.Single, password: String? = null, onDocumentError: (PdfViewerError) -> Unit? = null, shareButtonAlignment: Alignment = Alignment.BottomEnd, shareButtonPadding: PaddingValues = PaddingValues(16.dp), searchHighlights: List<PdfSearchHighlight> = emptyList(), activeSearchHighlightIndex: Int = -1, annotations: List<PdfViewerAnnotation> = emptyList(), annotationMode: Boolean = false, onAnnotationCreated: (PdfViewerAnnotation) -> Unit? = null, onAnnotationDeleted: (Int) -> Unit? = null, cacheStrategy: PdfPageCacheStrategy = PdfPageCacheStrategy.Auto)

Convenience overload for callers that already have raw PDF bytes (downloaded from the network, picked from ACTION_OPEN_DOCUMENT, etc.) and don't need to construct a PdfSource explicitly.

fun PdfViewer(document: <Error class: unknown class>, modifier: Modifier = Modifier, showShareButton: Boolean = true, shareFileName: String = "document.pdf", backgroundColor: Color = MaterialTheme.colorScheme.surfaceContainerLow, pageBackgroundColor: Color = Color.White, contentPadding: PaddingValues = PaddingValues(0.dp), pageSpacing: Dp = 4.dp, renderDensity: Float = pdfViewerDefaultRenderDensity, maxZoom: Float = DEFAULT_MAX_ZOOM, zoomEnabled: Boolean = true, doubleTapToZoom: Boolean = true, showZoomControls: Boolean = true, textSelectable: Boolean = true, hyperlinksEnabled: Boolean = true, invertColors: Boolean = false, showPageIndicator: Boolean = true, pageLayout: PdfPageLayout = PdfPageLayout.Single, password: String? = null, onDocumentError: (PdfViewerError) -> Unit? = null, shareButtonAlignment: Alignment = Alignment.BottomEnd, shareButtonPadding: PaddingValues = PaddingValues(16.dp), searchHighlights: List<PdfSearchHighlight> = emptyList(), activeSearchHighlightIndex: Int = -1, annotations: List<PdfViewerAnnotation> = emptyList(), annotationMode: Boolean = false, onAnnotationCreated: (PdfViewerAnnotation) -> Unit? = null, onAnnotationDeleted: (Int) -> Unit? = null, cacheStrategy: PdfPageCacheStrategy = PdfPageCacheStrategy.Auto)

Convenience overload that accepts a PdfDocument directly.

fun PdfViewer(source: PdfSource, modifier: Modifier = Modifier, showShareButton: Boolean = true, shareFileName: String = "document.pdf", backgroundColor: Color = MaterialTheme.colorScheme.surfaceContainerLow, pageBackgroundColor: Color = Color.White, contentPadding: PaddingValues = PaddingValues(0.dp), pageSpacing: Dp = 4.dp, renderDensity: Float = pdfViewerDefaultRenderDensity, maxZoom: Float = DEFAULT_MAX_ZOOM, zoomEnabled: Boolean = true, doubleTapToZoom: Boolean = true, showZoomControls: Boolean = true, textSelectable: Boolean = true, hyperlinksEnabled: Boolean = true, invertColors: Boolean = false, showPageIndicator: Boolean = true, pageLayout: PdfPageLayout = PdfPageLayout.Single, password: String? = null, onDocumentError: (PdfViewerError) -> Unit? = null, shareButtonAlignment: Alignment = Alignment.BottomEnd, shareButtonPadding: PaddingValues = PaddingValues(16.dp), searchHighlights: List<PdfSearchHighlight> = emptyList(), activeSearchHighlightIndex: Int = -1, annotations: List<PdfViewerAnnotation> = emptyList(), annotationMode: Boolean = false, onAnnotationCreated: (PdfViewerAnnotation) -> Unit? = null, onAnnotationDeleted: (Int) -> Unit? = null, cacheStrategy: PdfPageCacheStrategy = PdfPageCacheStrategy.Auto)

Compose Multiplatform viewer for PDFs produced by :pdfkmp (or any other source that hands you raw %PDF-… bytes).

Link copied to clipboard

Android clipboard write via the system ClipboardManager, using the application Context surfaced by ViewerContextHolder (the same App-Startup-populated handle the share / save launchers use). Best- effort — a missing context or an unavailable clipboard service is swallowed rather than crashing a viewer mid-interaction.

Copies text to the host platform's system clipboard.

iOS clipboard write via the general UIPasteboard. Setting string replaces the pasteboard contents with text, which is what a "Copy" affordance over selected PDF text should do.

Desktop clipboard write via the AWT system Toolkit clipboard. Best- effort — a headless environment (no display, so no system clipboard) is swallowed rather than crashing the viewer.

Link copied to clipboard
actual fun PdfViewerTopBar(title: String, modifier: Modifier, titleOverflow: PdfTopBarTitleOverflow, subtitle: String?, backLabel: String?, onBack: () -> Unit, onSearch: () -> Unit, onShare: () -> Unit, onPrint: () -> Unit, onDownload: () -> Unit, onAnnotate: () -> Unit, showBack: Boolean, showSearch: Boolean, showShare: Boolean, showPrint: Boolean, showDownload: Boolean, showAnnotate: Boolean, annotateActive: Boolean)

Android default — delegates to PdfViewerTopBarMinimalMono.

expect fun PdfViewerTopBar(title: String, modifier: Modifier = Modifier, titleOverflow: PdfTopBarTitleOverflow = PdfTopBarTitleOverflow.Ellipsis, subtitle: String? = null, backLabel: String? = null, onBack: () -> Unit = {}, onSearch: () -> Unit = {}, onShare: () -> Unit = {}, onPrint: () -> Unit = {}, onDownload: () -> Unit = {}, onAnnotate: () -> Unit = {}, showBack: Boolean = true, showSearch: Boolean = false, showShare: Boolean = true, showPrint: Boolean = false, showDownload: Boolean = true, showAnnotate: Boolean = false, annotateActive: Boolean = false)

Platform-aware default topbar for PdfViewer. Picks the design direction the host platform expects out of the box:

actual fun PdfViewerTopBar(title: String, modifier: Modifier, titleOverflow: <Error class: unknown class>, subtitle: String?, backLabel: String?, onBack: () -> Unit, onSearch: () -> Unit, onShare: () -> Unit, onPrint: () -> Unit, onDownload: () -> Unit, onAnnotate: () -> Unit, showBack: Boolean, showSearch: Boolean, showShare: Boolean, showPrint: Boolean, showDownload: Boolean, showAnnotate: Boolean, annotateActive: Boolean)

iOS default — delegates to PdfViewerTopBarClassicIos.

actual fun PdfViewerTopBar(title: String, modifier: Modifier, titleOverflow: PdfTopBarTitleOverflow, subtitle: String?, backLabel: String?, onBack: () -> Unit, onSearch: () -> Unit, onShare: () -> Unit, onPrint: () -> Unit, onDownload: () -> Unit, onAnnotate: () -> Unit, showBack: Boolean, showSearch: Boolean, showShare: Boolean, showPrint: Boolean, showDownload: Boolean, showAnnotate: Boolean, annotateActive: Boolean)

Desktop default — delegates to PdfViewerTopBarMinimalMono, the same brand-neutral, Material-flavoured bar Android uses. It reads naturally with a mouse and keyboard, where the iOS chevron-and-label convention would feel out of place.

Link copied to clipboard
fun PdfViewerTopBarClassicIos(title: String, modifier: Modifier = Modifier, titleOverflow: PdfTopBarTitleOverflow = PdfTopBarTitleOverflow.Ellipsis, backLabel: String? = null, onBack: () -> Unit = {}, onSearch: () -> Unit = {}, onShare: () -> Unit = {}, onPrint: () -> Unit = {}, onDownload: () -> Unit = {}, onAnnotate: () -> Unit = {}, showBack: Boolean = true, showSearch: Boolean = false, showShare: Boolean = true, showPrint: Boolean = false, showDownload: Boolean = true, showAnnotate: Boolean = false, annotateActive: Boolean = false)

Classic iOS Native topbar variant — matches Mail / Files / Notes conventions for products that target iOS exclusively (or that want to feel native on Apple platforms).

Link copied to clipboard
fun PdfViewerTopBarMinimalMono(title: String, modifier: Modifier = Modifier, titleOverflow: PdfTopBarTitleOverflow = PdfTopBarTitleOverflow.Ellipsis, subtitle: String? = null, onBack: () -> Unit = {}, onSearch: () -> Unit = {}, onShare: () -> Unit = {}, onPrint: () -> Unit = {}, onDownload: () -> Unit = {}, onAnnotate: () -> Unit = {}, showBack: Boolean = true, showSearch: Boolean = false, showShare: Boolean = true, showPrint: Boolean = false, showDownload: Boolean = true, showAnnotate: Boolean = false, annotateActive: Boolean = false)

Minimal Mono topbar variant — modern, brand-neutral, with the download action visually elevated as the primary CTA.

Link copied to clipboard

Captures the (Activity) Context once and returns a PdfPrintAction that streams the PDF bytes through Android's PrintManager + a PrintDocumentAdapter.

Returns a remembered PdfPrintAction bound to the current platform's print machinery. On Android this snapshots the androidx.compose.ui.platform.LocalContext; on iOS it presents the shared platform.UIKit.UIPrintInteractionController; on Desktop it shows the native print dialog off the UI thread.

Returns a stateless PdfPrintAction that presents iOS's shared UIPrintInteractionController.

Desktop "Print" — drives java.awt.print.PrinterJob with PdfBox's PDFPageable, the same PdfBox stack the Desktop viewer already uses to rasterise pages on screen. PDFPageable feeds the embedded PDF to the printer at full vector fidelity (no intermediate rasterisation), so what prints matches the on-screen document exactly.

Link copied to clipboard

Captures the Context once and returns a PdfSaveAction that persists the bytes to the user-visible Downloads directory.

Returns a remembered PdfSaveAction bound to the current platform's filesystem APIs. Pair it with a showSaveButton = false-style disable on any built-in chrome and host the save affordance from a spot in your own UI — typically a top-app-bar androidx.compose.material3.IconButton.

Returns a stateless PdfSaveAction backed by the app's <NSDocumentDirectory> — the closest iOS equivalent of an Android Downloads folder. Files written here surface in the system Files app under "On My iPhone / " and remain available across app launches.

Desktop "Save" — pops the OS-native Save As dialog (java.awt.FileDialog in SAVE mode), pre-filled with the suggested file name and defaulting to the user's ~/Downloads folder. This is the desktop analogue of Android's MediaStore + Toast and iOS's document picker: the dialog itself is the visible confirmation, and the user controls exactly where the file lands.

Link copied to clipboard

Captures the Context once and returns a PdfShareAction that writes the bytes to cacheDir/pdfkmp-viewer-share/<filename> and launches a Intent.ACTION_SEND chooser through FileProvider.

Returns a remembered PdfShareAction bound to the current platform's share machinery. On Android this snapshots the androidx.compose.ui.platform.LocalContext; on iOS this snapshots the key window's root view controller.

Captures the key window's root view controller once and returns a PdfShareAction that writes the bytes into NSTemporaryDirectory and presents a UIActivityViewController from the topmost presented controller. The temp file is overwritten on every share so a regenerated document with the same name correctly replaces the previous payload.

Desktop "Share" — Desktop OSes have no system share sheet equivalent to Android's ACTION_SEND or iOS's UIActivityViewController, so the closest useful behaviour is to write the PDF to a temp file and hand it to the OS default handler via Desktop.open (Preview, Acrobat, Evince, …). From there the user can print, forward, or save-as. No-ops gracefully on headless or unsupported environments.

Link copied to clipboard
fun searchPdfText(textRuns: List<<Error class: unknown class>>, query: String): List<PdfSearchHighlight>

Scans every PdfTextRun for case-insensitive occurrences of query and returns a sorted list of PdfSearchHighlights in document order (page → top-to-bottom → left-to-right).