问题描述
我想使用 Navigator.share() API - Javascript 在移动设备上共享 PDF/IMG 文件
我的代码:
var pdff = new html2pdf().set({ html2canvas: { scale: 3 } }).from(html)
.save().outputPdf().then(function(pdf) {
var base64url = btoa(pdf);
const blob = fetch(base64url).blob();
console.log(blob.type);
const file = new File([blob],'ticket.pdf',{ type: blob.type });
navigator.share({
title: 'Hello',text: 'Check out this image!',files: [file],})
});
不工作 -> 发送空文件 我也试过创建
- new File = new File([blob],'ticket.jpg',{ type: blob.type }); 但仍然无法正常工作
也尝试过:从 html2pdf 输出 Img() 并发送空图像
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)