File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
apdfjs-lib/src/main/java/com/github/truefedex/apdfjs Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -57,13 +57,23 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) {
5757 }
5858
5959 public void loadFromAssets (String pdfAssetsPath ) {
60- apdfjsInterface .fileName = "file:///android_asset/" + Uri .encode (pdfAssetsPath , "UTF-8" );
61- webView .loadUrl (PDFJS_ASSETS_PATH );
60+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .JELLY_BEAN ) {
61+ webView .loadUrl ("file:///android_asset/pdfjs-1.7.225-dist/web/viewer.html?file=file:///android_asset/" +
62+ Uri .encode (pdfAssetsPath , "UTF-8" ));
63+ } else {
64+ apdfjsInterface .fileName = "file:///android_asset/" + pdfAssetsPath ;
65+ webView .loadUrl (PDFJS_ASSETS_PATH );
66+ }
6267 }
6368
6469 public void loadFromFile (String pdfFilePath ) {
65- apdfjsInterface .fileName = Uri .encode (pdfFilePath , "UTF-8" );
66- webView .loadUrl (PDFJS_ASSETS_PATH );
70+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .JELLY_BEAN ) {
71+ webView .loadUrl ("file:///android_asset/pdfjs-1.7.225-dist/web/viewer.html?file=file://" +
72+ Uri .encode (pdfFilePath , "UTF-8" ));
73+ } else {
74+ apdfjsInterface .fileName = "file://" + pdfFilePath ;
75+ webView .loadUrl (PDFJS_ASSETS_PATH );
76+ }
6777 }
6878
6979 public class APDFJSInterface {
You can’t perform that action at this time.
0 commit comments