浏览器打印,不显示图像

Browser print, doesn´t show images

我正在尝试使用 printThis jQuery 插件在我的网页上打印一些 "chosen" 内容。当我按 print_btn 时,没有图像或 <hr> 显示在打印件中。为什么?

HTML

<button id="print_btn"></button>
<div class="elementBricka display" style="page-break-after:always">
    <div class="lkbLoggo"></div>
    <hr>
     ....

CSS

#elementBrickor{
    align-items: center;
}

.elementBricka{
    width: 9.614cm;
    height: 14.404cm;
    border: 1px solid;
    background-color: white;

    float: none;
    margin-left: auto;
    margin-right: auto;
}
.lkbLoggo{
    width: 9.182cm;
    height: 2.721cm;
    margin-top: 0.199cm;
    background-image: url("/img/lkb_logga2.png");
    background-repeat: no-repeat;
    background-position: center;
}

JS

$(document).ready(function () {
    $('#print_btn').click(function () {
        $('.display').printThis({
            debug: true,
            importCSS: true,
            importStyle: true,
            loadCSS: "/Data.css",
            pageTitle: false,
        });
    });
});

更新

我会回答我自己的问题。
这与"PrintThis".
无关 这是一个浏览器 "issue"。
但是很容易通过添加来修复: !important 在我加载 img 的 Css 文件中。

图片一般不打印,这是浏览器的设置。

转到工具/Internet 选项/高级/并确保勾选 "Print Background and Images"。

但是,没有解决方法可以使用 printThis 插件打印图像。

如果您想尝试使用 jquery 打印图像,您可以这样做:http://jsfiddle.net/8dXvt/626/

function nWin() {
  var w = window.open();
  var html = $("#toNewWindow").html();
  /*for(var i=0;i<5;i++){
  $("#toNewWindow").clone().prependTo("body")
 }*/
 $(w.document.body).html(html);
 setTimeout(function(){w.print()}, 1500);
}

好的,所以没有办法让 "PrintThis" 打印我的图像。
但是我在 CSS:

中找到了一个方法
.lkbLoggo{
    width: 9.182cm !important;
    height: 2.721cm !important;
    margin-top: 0.199cm !important;
    background-image: url("/img/lkb_logga2.png") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
}

只需在每行后添加 !important 即可在打印中显示。
现在..我想要一个函数来使整个 class 变得重要,而不是将它添加到每一行。

$('.display').printThis({
base='true'
});

试试这个

我的解决方案是实施

-webkit-print-color-adjust: exact !important;