Androidpdfviewer: How can I load the pdf file from firebase in android studio without downloading the URL?

Created on 4 Aug 2019  路  8Comments  路  Source: barteksc/AndroidPdfViewer

All 8 comments

you can't. check https://github.com/barteksc/AndroidPdfViewer#why-i-cannot-open-pdf-from-url

Dude I already did it

Can you shed some light how did you do that? @Atlas789

I used a method that will call the url from the webpage.

Did you use this library to load pdf or the webview?

webview =)

@Atlas789 can u send me the method that u used

Passing the firebase storage url will open without downloading

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

                        .load();
            }
        }.execute();

    }
Was this page helpful?
0 / 5 - 0 ratings