gpt4 book ai didi

javascript - 浏览器打印,不显示图像

转载 作者:行者123 更新时间:2023-11-28 06:48:29 24 4
gpt4 key购买 nike

我正在尝试使用 printThis jQuery 插件在我的网页上打印一些“选择的”内容。当我按下 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”无关。
这是一个浏览器“问题”。
但是通过添加很容易修复:!important在我加载 img 的 Css 文件中。

最佳答案

我的解决方案是实现

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

关于javascript - 浏览器打印,不显示图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33912878/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com