javaandroidandroid-studiopdf-viewer

Download PDF file for offline viewing


I'm trying to cache PDF files on the user's device and open them within my app at a later time.

With this package: https://github.com/barteksc/AndroidPdfViewer

I use pdfView.fromUri(uri) which loads the file from the URL every time the page is loaded. Is there a function I can use to cache these files for offline viewing?


Solution

  • Download the PDF yourself, using your favorite HTTP client API. Then, use fromFile() rather than fromUri().