window.print()仅打印“可见"窗口.屏幕的一部分 [英] window.print() only prints the "viewable" part of the screen
本文介绍了window.print()仅打印“可见"窗口.屏幕的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个可滚动的屏幕,上面有一个打印按钮,在onclick事件上调用了"window.print()"函数.
I've a scrollable screen and I'm having a print button on it and "window.print()" function is called on its onclick event.
我的问题是它仅打印屏幕的可见"部分,而不是整个屏幕.如果页面是可滚动的,则如果内容不适合一页,则打印应扩展到2(或更多)页.但就我而言,它始终只打印一页,而其余内容则不打印.
My problem is it only prints the "viewable" part of the screen, not the whole screen. If a page is scrollable, the print should extend to 2(or more) pages if contents do not fit in 1 page. But in my case, it always print only 1 page and rest of contents are not printed.
推荐答案
可能的重复项:您基本上必须将以下内容添加到主CSS文件中
You basically have to add the following to your main css file
@media print {
body, html, #wrapper {
height: 100%;
}
}
这篇关于window.print()仅打印“可见"窗口.屏幕的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文