我需要找到一个解决方案,使任何打印从webview静默使用window.print()
在Electron html文件中,我使用:
const webview = document.querySelector('webview')
webview.print({silent: true})但是仍然弹出了打印对话框,任何人都可以帮我找出我在上面代码中的错误。
发布于 2021-09-10 18:14:46
测试一下这个
path = "your path/name file.pdf"
document.querySelector('webview').printToPDF({
marginsType: 0,
pageSize: 'A4',
printBackground: true,
printSelectionOnly: false,
landscape: false
}).then(data => {
fs.writeFile(path, data, function (err) {
if (err) {
console.log(err);
} else {
console.log('Sucess');
}
});
});https://stackoverflow.com/questions/60840737
复制相似问题