Display PDF file inside my android application

后端 未结 8 1640
日久生厌
日久生厌 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");
    
    0 讨论(0)
  • 2020-12-01 05:33

    Highly recommend you check out PDF.js which is able to render PDF documents in a standard a WebView component.

    Also see https://github.com/loosemoose/androidpdf for a sample implementation of this.

    0 讨论(0)
提交回复
热议问题