1、使用uniapp官网的api打开=>uni.openDocument

uni.openDocument({
    filePath: res.tempFilePath,
    fileType: "pdf",
    success: () => console.log("打开PDF成功")
})

2、使用原生的方式,通过plus.io的方式打开

plus.runtime.openFile(
    plus.io.convertLocalFileSystemURL(filePath),
    {},
    () => {},
    (e) => {
      uni.showToast({ title: '无法打开PDF,请安装阅读器', icon: 'none' });
    }
);

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐