我正在创建证书,其中我正在使用 div 背景图像。一切正常。在打印 div 背景图像时不显示。即使在 pdf 中也不显示 Div 背景。 我正在使用这个媒体查询。
@media print
{
* {-webkit-print-color-adjust:exact;}
.clsprint
{
background-image:url(cert.jpg);
background-repeat:no-repeat;
}
}
最佳答案
尝试在打印时在 Js 中添加样式
`var divElements = document.getElementById("divAlterationPrint").innerHTML;
var w = window.open('', 'Placement Form', 'width=860,scrollbars=yes');
w.document.write('<html><head><title>Placement Form</title>');
var sdf = '<style>#divId {background-image:url(cert.jpg);}</style>';
w.document.write(sdf);
w.document.write('</head><body>');
w.document.write(divElements);
w.document.write('</body></html>');
w.print();
w.document.close();`
关于asp.net - 在 asp.net 中打印时不显示 div 背景图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21850127/