asp.net - 在 asp.net 中打印时不显示 div 背景图像

标签 asp.net css html media-queries

我正在创建证书,其中我正在使用 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/

相关文章:

asp.net - 关于SQL注入(inject)的帮助

c# - 如何在每个请求的基础上跟踪 ASP.NET

asp.net - 可能的 SOAP 版本不匹配

css - 使用 Wordpress 页面作为样式表?

css - 响应式网页设计 - Bootstrap

html - 渲染列表时,mat-paginator 的范围设置回其初始值

javascript - 为浏览器设置视口(viewport)大小

asp.net - 每个浏览器的首次加载缓慢或一段时间后加载缓慢

html - 无法理解 span 标签和 css "margin-*"属性

Javascript 没有在手机的 chrome 应用程序中运行?