Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
truefedex committed Jun 9, 2017
1 parent 2aebbd6 commit 8d1a2e4
Showing 1 changed file with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,23 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) {
}

public void loadFromAssets(String pdfAssetsPath) {
apdfjsInterface.fileName = "file:///android_asset/" + Uri.encode(pdfAssetsPath, "UTF-8");
webView.loadUrl(PDFJS_ASSETS_PATH);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
webView.loadUrl("file:///android_asset/pdfjs-1.7.225-dist/web/viewer.html?file=file:///android_asset/" +
Uri.encode(pdfAssetsPath, "UTF-8"));
} else {
apdfjsInterface.fileName = "file:///android_asset/" + pdfAssetsPath;
webView.loadUrl(PDFJS_ASSETS_PATH);
}
}

public void loadFromFile(String pdfFilePath) {
apdfjsInterface.fileName = Uri.encode(pdfFilePath, "UTF-8");
webView.loadUrl(PDFJS_ASSETS_PATH);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
webView.loadUrl("file:///android_asset/pdfjs-1.7.225-dist/web/viewer.html?file=file://" +
Uri.encode(pdfFilePath, "UTF-8"));
} else {
apdfjsInterface.fileName = "file://" + pdfFilePath;
webView.loadUrl(PDFJS_ASSETS_PATH);
}
}

public class APDFJSInterface {
Expand Down

0 comments on commit 8d1a2e4

Please sign in to comment.