Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

修改并集成pdf.js使Android WebView支持浏览pdf,jpg,png格式,相比mupdf更为简单且轻量,只需要几行代码即可支持加载本地pdf(受制于pdf.js性能影响,如需加载大型pdf对显示速度有需求,请使用mupdf)

Notifications You must be signed in to change notification settings

SmartCoded/AndroidWebViewPDF

Open more actions menu
 
 

Repository files navigation

AndroidWebViewPDF

此Demo集成pdf.js使Android WebView支持浏览pdf,jpg,png格式,相比mupdf更为简单且轻量,只需要几行代码即可支持加载本地pdf(受制于pdf.js性能影响,如需加载大型pdf对显示速度有需求,请使用mupdf)

预览效果

  预览效果

使用

xml中引入控件
<g707175425.pdflib.PdfWebView
    android:id="@+id/webview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>
  //使用此方法打开指定路径
  webview.loadFilePath(path);

混淆

由于用到了js和java桥 需要proguard-project.txt 或者 proguard-rules.pro中加入如下配置:

-keep class cn.schope.lightning.activity.PdfViewerActivity.WebViewBridge.**{*;}

About

修改并集成pdf.js使Android WebView支持浏览pdf,jpg,png格式,相比mupdf更为简单且轻量,只需要几行代码即可支持加载本地pdf(受制于pdf.js性能影响,如需加载大型pdf对显示速度有需求,请使用mupdf)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 76.9%
  • HTML 23.1%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.