Simple, lightweight, PDF viewer for android. Supports assets paths, or internet URLs.
It will load a PDF and show it in a custom view, it can be scrolled vertically and zoomed in or out.
For now it only supports PDFs from assets or from a URL (using okhttp to download)
- using PDFRenderer API from android
- download the pdf file and store it in local cache as PDF, and load pages while they are viewed
- show a recyclerview with all those images
- let the images zoom in and out using Zoomage
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.boldijar:pdfy:<latest-version>'
}
Let the library know how to load the images. I didn't wanted to include this in the library because people might want to use their own caching library, you can chech the demo to see how to do this with Glide.
class GlideLoader : PdfyImageLoader() {
override fun loadImage(path: String, imageView: ImageView) {
Glide.with(imageView).load(path).into(imageView)
}
}
And set the loader before you use the library:
PdfyParser.init(GlideLoader())
Now load a PDF:
pdfyView.setPdf(
path = "https://www.ignaciouriarte.com/works/18/pdfs/A100page47.pdf",
type = PdfyType.FROM_INTERNET,
uniqueCacheName = "<somePdfId>" // optional, used for caching, default is a random UUID
)
You can also load it from assets, by using PdfyType.FROM_ASSETS and using the relative path after assets, or just use the LOCAL_FILE type, and use the absolute file path.