Benjamin
04/23/2024, 7:29 PMSwapnil Musale
04/23/2024, 7:35 PMiosMain
sourceSetSwapnil Musale
04/23/2024, 7:39 PMPDFView
component in ComposeMultiplatform you can use UIKitView
for more info check here : https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-uikit-integration.html#use-uikit-inside-compose-multiplatformBenjamin
04/23/2024, 7:48 PMPDFView
? I have tried it earlier, but I dont what to give it so it displays my pdf. The pdf is hosted online for the moment. The repo was really usefull for android but I dont have the knowledge at the moment for it to help me in iosSwapnil Musale
04/23/2024, 7:51 PMBenjamin
04/24/2024, 12:25 PMval encoded = Base64.encode(pdf.value)
UIKitView(
factory = { PDFView() },
modifier = Modifier.fillMaxSize(),
update = {
it.autoScales = true
it.document = PDFDocument(/* what to give here */)
}
)
I have tried to create the PDFDocument
, but I haven't found a way for it to have the right type so it compiles. It wants either an NSURL
or NSData
, but I was unable to create it. l wasn't able to translate your code from swift to kotlin using a UIKitView
. Do you know how I could do it? Our project structure are really different so im having a hard time doing it from your projectBenjamin
04/24/2024, 2:05 PMUIKitView(modifier = Modifier.fillMaxSize(),
factory = {
WKWebView()
},
update = { webView ->
webView.loadRequest(
NSURLRequest.requestWithURL(
NSURL.URLWithString("<https://myreport.altervista.org/Lorem_Ipsum.pdf>")!!
)
)
}
)
Swapnil Musale
04/24/2024, 2:17 PMBenjamin
04/24/2024, 2:31 PM