Download PDF file for offline viewing

Issue

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().

Answered By – CommonsWare

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published