Open kaarthik1999 opened 3 years ago
I am also facing a similar issue. I am unable to display pdf from firebase
To display a pdf from firebase storage:
Suppose your pdf file path in the storage is "pdfs/book1.pdf"
Kotlin code:
Storage reference
val storage: FirebaseStorage = FirebaseStorage.getInstance()
val storageRef = storage.reference.child("pdfs/book1.pdf")
Create a temporary file and store pdf from the storage in it and load using pdfViewer
val localFile = File.createTempFile("book", "pdf")
storageRef.getFile(localFile).addOnSuccessListener {
pdfViewer.fromFile(localFile).load()
}
val pdfUrl=bookJsonObject.getString("pdf") val uri=Uri.parse(pdfUrl) pdfView.fromUri(uri) The above is my kotlin code I am using implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'