Is it posible to render and show pdf taken from a url like https://mslc.osu.edu/sites/default/files/Integral%20Calculus%20Formula%20Sheet_0.pdf? If it's, how? Thanks.
@titosobabas unfortunately you need to download pdf, fo example using retrofit https://futurestud.io/tutorials/retrofit-2-how-to-download-files-from-server and then call pdfView.fromBytes(byteArray)
itosobabas unfortunately you need to download pdf, fo example using retrofit https://futurestud.io/tutorials/retrofit-2-how-to-download-files-from-server and then call
pdfView.fromBytes(byteArray)
can u give me example how i can call this after downloading ?
hey is this only for pdfs ??
can i view ppts using this??
private void getPdf(String url) {
pdfView.setVisibility(View.VISIBLE);
final InputStream[] input = new InputStream[1];
new AsyncTask<Void, Void, Void>() {
@SuppressLint({"WrongThread", "StaticFieldLeak"})
@Override
protected Void doInBackground(Void... voids) {
try {
input[0] = new URL(url).openStream();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
pdfView.fromStream(input[0])
.pageFitPolicy(FitPolicy.WIDTH)
.load();
}
}.execute();
}
Most helpful comment
private void getPdf(String url) {