rememberPdfSaveAction
Captures the Context once and returns a PdfSaveAction that persists the bytes to the user-visible Downloads directory.
Two code paths:
API 29+ (Android 10 / Q+) — uses the Scoped-Storage-friendly
MediaStore.Downloadscontent URI. No runtime permission required; the file is owned by the host app and visible to every reader (Files, Drive, Gmail attach, etc.).API < 29 — falls back to writing into
Environment.getExternalStoragePublicDirectory(DIRECTORY_DOWNLOADS). On API 28 and below this needsWRITE_EXTERNAL_STORAGE. The library does not request the permission itself; consuming apps targeting API < 29 must declare it in their manifest. On permission denial the action surfaces a Toast and bails.
Existing files with the same name are overwritten. A short Toast confirms success; failures are logged but never rethrown — a viewer's save action shouldn't be able to crash the host app.
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 /
Existing files with the same name are overwritten via NSData.writeToURL(atomically: true) so the user sees a fresh copy each time. Failures (disk full, sandboxed write denied) fall through silently — the viewer's save action shouldn't be able to crash the host app, and iOS doesn't have a Toast equivalent the library can reach without UIKit ceremony.
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.
Returns silently if the user cancels. Failures (read-only target, disk full) are swallowed so a save tap never crashes the viewer.