window.print()不打印整个页面 [英] window.print() is not printing the whole page

查看:2080
本文介绍了window.print()不打印整个页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个页面

I have a page

我想打印此页面。在打印按钮我使用这样的东西

I want to print this page. On print button i am using something like this

<input id="print" type="submit" onclick="window.print();" />

但问题是它不打印整页。就像它只打印当前在视图中一样。当我点击打印按钮然后直到电子邮件:tahir@7-cs.com 页面打印。它不会打印滚动条下方的文本。

But the problem is it is not printing the whole page. Like it only print that is currently in the view. When i click on the print button then till Email:tahir@7-cs.com page print. It does not print the text below the scrollbar.

如何打印全文。就像假设我有一个非常大的页面,我使用选项卡来容纳我的页面。当点击打印按钮,然后我想包括整个页面,包括选项卡。我该怎么做?

How can i print the whole text. Like suppose i have a very big page and i am using tabs to accommodate my page. And when click on print button, then i want to include the whole page including tabs. How can i do it?

谢谢

推荐答案

你应该使用一个单独的css文件进行打印页面或使用css3媒体查询:

you should use a separate css file for printing the page or use css3 media queries:

<link rel="stylesheet" href="css/print.css" type="text/css" media="print"/>

在创建css打印文件时,使用百分比值是最佳选项。

using percentage values its the best option when you create a css print file.

body, html, #wrapper {
    width: 100%;
}

或在主css文件中:

@media print {
      body, html, #wrapper {
          width: 100%;
      }
}

这篇关于window.print()不打印整个页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆