PdfShareFab

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.

Drop it inside a PdfViewer's overlay slot to add a share button exactly where you want it, with whatever colour / size / alignment suits the surrounding chrome. The convenience overload that takes a PdfDocument saves the call site from materialising the bytes eagerly — the ByteArray is realised on tap instead of on every recomposition.

Parameters

bytes

encoded %PDF-… payload to share.

fileName

filename presented to the share sheet (must include the .pdf extension).

modifier

applied to the underlying FloatingActionButton.

containerColor

background colour of the FAB.

contentColor

colour of the icon glyph.


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:

PdfViewer(
document = doc,
showShareButton = false,
overlay = { PdfShareFab(doc, modifier = Modifier.align(Alignment.BottomEnd).padding(16.dp)) },
)