我们有一个通过printthis.js打印的页面,除了超链接(如果importStyle: false )没有显示,一切都正常工作,我们需要将其设置为false,因为文档的样式需要与页面样式有很大的不同。我尝试了几个不同的风格,在CSS文件中的链接,为pdf,但没有任何效果。这是当前的代码。
jQuery(function(){
jQuery('a[id="printbutton"]').click(function(){
jQuery('').printThis({
debug: false,
importStyle: false,
importCSS: false,
loadCSS: "/pdfstyle.css",
removeInline: true,
footer: jQuery(".printthis"),
});
});
});<p style="text-align: left;margin-bottom: 30px;">Please click the button below to start your download</p>
<a onClick="document.title = 'My new title';" id="printbutton" class="pp-button" style="padding: 10px; background-color: #9aab21; color: white; margin-top: 20px;" role="button" href="#">
<span class="pp-button-text">DOWNLOAD THE PDF</span>
</a>发布于 2022-04-25 19:16:11
请参阅:https://github.com/jasonday/printThis/wiki/Styling-Printed-Content#printing-backgrounds
默认情况下,浏览器不打印背景以保存墨汁/墨粉,但不调整前景色。在CSS中,链接就在那里,它们只是在打印文档的白色背景下变成白色:
background-color: #9aab21; color: white;
移除背景颜色并更改链接的颜色,它们将是可见的。
https://stackoverflow.com/questions/71997986
复制相似问题