-
Notifications
You must be signed in to change notification settings - Fork 2
share pdf android
github-actions[bot] edited this page Jun 2, 2026
·
1 revision
import com.mobilebytelabs.kmptoolkit.share.Share
import com.mobilebytelabs.kmptoolkit.share.SharePayload
import com.mobilebytelabs.kmptoolkit.share.ShareOptions
import java.io.File
suspend fun shareInvoice(pdfFile: File) {
Share.share(
payload = SharePayload.File(
path = pdfFile.absolutePath,
mimeType = "application/pdf",
displayName = pdfFile.name,
),
options = ShareOptions(title = "Share invoice"),
)
}-
Android: the file must be reachable via FileProvider. cmp-share auto-wires
the manifest
<provider>entry; if you've overridden it, ensure your authority matches${applicationId}.cmp-share.fileprovider. -
iOS: mime type ignored — UTI inferred from the file extension; use
.pdf. - JS / wasmJs: falls back to download-then-share via Web Share API Level 2; Safari only supports it inside a user-gesture handler.
- JVM Desktop: opens the system "Share" dialog on macOS Sonoma+ / Windows 11; otherwise opens the Files browser at the parent directory.
- Module: cmp-share
- Sample:
samples/sample-cmp-share/composeApp/.../FileShareDemo.kt - See also: cmp-pdf-generator for producing the PDF first.
** Partials**
App Intents
Bubble
Clipboard
Cookbook
- Clipboard Copy Text
- Clipboard Read Text
- Consumer Anon Key Setup
- Crashlytics Attribution Per Library
- Ifonline Block
- Index
- Index
- Index
- Index
- Open Url Compose
- Pick And Share Image
- React To Offline
- Register Firebase Hooks
- Share Pdf Android
- Share Text
- Wifi Vs Cellular
Firebase Analytics
In App Update
Intent Launcher
Inter App Comms
Modules
- Cmp App Intents
- Cmp App Intents Compose
- Cmp Bubble
- Cmp Clipboard
- Cmp Deep Link
- Cmp Firebase Analytics
- Cmp In App Update
- Cmp Intent Launcher
- Cmp Intent Launcher Compose
- Cmp Library
- Cmp Network Monitor
- Cmp Network Monitor Compose
- Cmp Observe
- Cmp Observe Koin
- Cmp Open Url
- Cmp Pdf Generator
- Cmp Product Tickets
- Cmp Remote Config
- Cmp Share
- Cmp Share Compose
- Cmp Toast
Network Monitor
Open Url
Pdf Generator
Remote Config
Share
Toast
User Tickets
General