Android - Load PDF inside webview

前端 未结 5 1093
暖寄归人
暖寄归人 2020-12-28 11:11

I have this webview code and I want to make it possible to have the PDF files opened when a user clicks on a PDF link. Here is the code, can you tell me what I have to put

5条回答
  •  执念已碎
    2020-12-28 12:05

    Loading pdf within a webview:

    WebView wv = (WebView) view.findViewById(R.id.webPage);
                wv.getSettings().setJavaScriptEnabled(true);
                wv.setWebViewClient(new WebClient());
                wv.loadUrl("http://drive.google.com/viewerng/viewer?embedded=true&url=" + mUrl);
                wv.getSettings().setBuiltInZoomControls(true);
    

    mUrl - will be your pdf link

提交回复
热议问题