Chrome window.print()缺少页面元素 [英] Chrome window.print() missing page elements
问题描述
我目前遇到问题Chrome(47.0.2526.111,OS X)无法在预览中和使用按钮打印时使用onclick = window.print()事件渲染整个页面。
I am currently having an issue with Chrome (47.0.2526.111, OS X) not rendering the whole page both in preview and when printed when using a button, with a onclick=window.print() event.
某些元素未呈现,例如某些段落块,偶尔会出现一些图像。
Certain elements are not rendered, such as some paragraph blocks and occasionally some images.
此问题不是在其他浏览器中复制,奇怪的是,只有在我添加了一个打印按钮时才出现,并且在使用Ctrl + P或Chrome打印样式表媒体模拟时,行为无法观察到。
This issue is not replicated in an other browser, and oddly enough only appeared once I added a print button, and the behaviour is not observable when using Ctrl+P or in the Chrome print stylesheet media emulation.
这个问题看起来非常有气质,如果我通过Ctrl + PI渲染了打印视图,我可以返回并成功使用打印按钮并显示所有元素。
The issue seems very temperamental, if I have rendered the print view via a Ctrl+P I am able to go back and use the print button successfully with all elements rendering.
推荐答案
为 media =print使用单独的
: print.css
文件
Use separate print.css
file for media="print"
:
<link rel="stylesheet" type="text/css" href="path/to/print.css" media="print">
:
@media print{
div.print{
width: 100%;
}
}
这篇关于Chrome window.print()缺少页面元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!