Display PDF file inside my android application

后端 未结 8 1646
日久生厌
日久生厌 2020-12-01 05:05

I cannot figure out how to show a PDF file inside an Android application. So far I\'ve found out that it is possible to launch an Intent and open the PDF using

8条回答
  •  一生所求
    2020-12-01 05:32

    you can use webview to show the pdf inside an application , for that you have to :

    1. convert the pdf to html file and store it in asset folder
    2. load the html file to the web view ,

    Many pdf to html online converter available.

    Example:

        consent_web = (WebView) findViewById(R.id.consentweb);
        consent_web.getSettings().setLoadWithOverviewMode(true);
        consent_web.getSettings().setUseWideViewPort(true);
        consent_web.loadUrl("file:///android_asset/spacs_html.html");
    

提交回复
热议问题