小程序打开PDF文件,大部分安卓手机会闪退。(苹果机正常)
该PDF文件有 64m 左右,我换成 45m 左右的 PDF 文件是正常打开的。
请教大佬们,是什么原因?
小程序复现(扫描下方二维码):
if (productBookInfo.itemBookType === 2) {
if (!productBookInfo.itemBook) {
wxApi.showToast({ title: `该产品暂无说明书`, icon: 'none' });
return;
}
wxApi.showLoading();
const url = productBookInfo.itemBook.split('?')[0];
wxApi.downloadFile({
// 示例 url,并非真实存在
url,
success: function (file) {
const filePath = file.tempFilePath;
wxApi.openDocument({
filePath,
fileType: 'pdf',
success: function (ress) {
console.log('打开文档成功', ress);
wxApi.hideLoading();
},
});
},
});
}

注意,PDF有2张图片,要等两张图片都加载完,一会就闪退了