在使用Mozilla的Andr​​oid的WebView显示PDF文件pdf.js低于19的Andr​​oid API级别级别、文件、oid、WebView

2023-09-06 15:58:53 作者:骨子里的酷

我使用 Mozilla的pdf.js 在Android中的WebView来显示PDF文件。

I'm using mozilla pdf.js in Android WebView to Show PDF files.

code是工作的罚款中的 Android的API级别19

Code is working fine in Android API Level 19.

Uri path = Uri.parse(Environment.getExternalStorageDirectory().toString() + "/test.pdf");
webView.loadUrl("file:///android_asset/pdfviewer/index.html?file=" + path); 

但它不工作在 Android的API等级16及以下

Device A的白色空白屏幕。

A White blank Screen displays on Device.

有没有什么办法可以解决这个问题?

Is there any way to resolve this issue?

推荐答案

在在线编辑pdf.worker.js 1446

Edit pdf.worker.js in line 1446

if (typeof Blob !== 'undefined') {
    try {return new Blob([data], { type: contentType });}
    catch(e)
    {return null;}
}