PdfShareFab
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
encoded %PDF-… payload to share.
filename presented to the share sheet (must include the .pdf extension).
applied to the underlying FloatingActionButton.
background colour of the FAB.
colour of the icon glyph.
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)) },
)