Are you assuming this line would work, magically ?
newFragment.arguments = bundleOf("uri" to uri)
Nevertheless, I am trying to use the PdfViewer composable itself, with "1.0.0-alpha11" dependency, and this minimalist code doesn't work out-of-the-box.
/* dependency-libraries
androidx.pdf:pdf-compose:$version
androidx.pdf:pdf-document-service:$version
*/
@Composable
fun PdfViewerScreen(
fileUri: android.net.Uri // "content://..."
) {
val context = LocalContext.current.applicationContext // Just-in-case
val state = remember { androidx.pdf.compose.PdfViewerState() }
var doc by remember { mutableStateOf<androidx.pdf.PdfDocument?>(null) }
LaunchedEffect(fileUri) {
doc = androidx.pdf.SandboxedLoader(
context,
Dispatchers.IO
).openDocument(fileUri)
}
DisposableEffect(doc) {
onDispose { doc?.close() } // Closable PdfDocument
}
doc?.also {
androidx.pdf.compose.PdfViewer(
modifier = Modifier.fillMaxSize(),
pdfDocument = doc,
state = state
)
}
}
What also bothers me is that there's no Loading-State callbacks, error callbacks ?