repositories {
maven { url "https://jitpack.io" }
}
dependencies {
implementation 'com.github.longdt57:Pdf-View:{version}'
}
<lee.module.pdfview.pdf.PdfView
android:layout_width="match_parent"
android:layout_height="match_parent" />
- Set Data by Uri:
pdfView.setUri(...)
- Set Data by PdfRenderer:
pdfView.setPdfRenderer(renderer)
// pdf file Uri
val uri = ...
Intent(Intent.ACTION_VIEW).apply {
val type = "application/pdf"
setDataAndType(uri, type)
addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
startActivity(this)
}