如何解决如何使用窗口打印从 fetch API 打印图像?
如何使用窗口打印从 fetch API 打印图像? 图像已经出现在页面上,但是当弹出窗口出现时,图像消失了
async function fetchImage() {
let response = await fetch(base_url_image + nopers + '/noTam/' + notam + '/download');
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
return await response.blob();
}
fetchImage().then((blob) => {
imagePers = URL.createObjectURL(blob);
document.getElementById('fotoPersonel').innerHTML += `<img src="${imagePers}" alt="foto personel">`;
}).then(() => {
window.print();
})
.catch(error => console.error('Error:',error));
window.close();
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。