rememberPdfShareAction

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.

The temp file is written every call (it would be wrong to keep a stale copy around — the user might be sharing a freshly-regenerated document with the same name) and is overwritten in place. Android's cache eviction policy reclaims the bytes when the device runs low on space; the library does not delete it eagerly because the receiving app needs the file to remain readable for the duration of the share (which can include a chooser dismissal, a multi-second upload, etc.).

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.

Useful when the host app wants its own share affordance — typically a toolbar / app-bar icon — instead of (or alongside) the built-in FAB exposed by PdfViewer. Pair it with showShareButton = false on PdfViewer to suppress the default button and route the share through a custom call site.

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.

iPad caveat — UIKit insists on a popoverPresentationController with a non-nil sourceView / sourceRect whenever a share sheet is presented on iPad, otherwise it raises NSGenericException. Neither UIPopoverPresentationController nor the KVC accessors needed to reach it from outside the typed binding are exposed in Kotlin/Native's UIKit klib at the moment, so this default action skips the presentation on iPad. Apps targeting iPad should disable the built-in button via showShareButton = false and present the share sheet from Swift / Objective-C where the popover anchor can be set directly.

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.