[英]Print PDF File using Print.js
I'm having difficulties to show print modal passing a pdf file.我很难显示通过 pdf 文件的打印模式。
setTimeout(() => {
printJS({
printable: '53544.pdf',
type: 'pdf',
showModal: true,
fallbackPrintable: () => console.log("FallbackPrintable"),
onPrintDialogClose: () => console.log('The print dialog was closed'),
onIncompatibleBrowser: () => console.log('Pdf was opened in a new tab due to an incompatible browser')
})
console.log("TimeOut Executado");
}
,3000)
It is happing just with pdf files , I tested with image like logo.png
and it worked.它只是与pdf 文件有关,我用logo.png
之类的图像进行了测试,它工作正常。 I insert that params to callback to trying to figured out what is happing, and OnPrintDialogClose()
is trigged, but the modal box did not show!我将该参数插入回调以试图弄清楚发生了什么,并且触发了OnPrintDialogClose()
,但模式框没有显示! The screen blink and this message is showed 'The print dialog was closed'
.屏幕闪烁并显示此消息'The print dialog was closed'
。
Any suggestion?有什么建议吗?
Looking at https://printjs.crabbly.com/#configuration I see there are some more configuration options that might give you clues.查看https://printjs.crabbly.com/#configuration我发现还有一些配置选项可能会为您提供线索。 I would recommend trying this (I added onError and modalMessage):我建议尝试这个(我添加了 onError 和 modalMessage):
setTimeout(() => {
printJS({
printable: '53544.pdf',
type: 'pdf',
showModal: true,
modalMessage: "Document Loading...",
onError: (err) => console.log(err),
fallbackPrintable: () => console.log("FallbackPrintable"),
onPrintDialogClose: () => console.log('The print dialog was closed')
});
console.log("TimeOut Executado");
}, 3000)
Then my troubleshooting questions would be:那么我的故障排除问题将是:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.