简体   繁体   English

window.print()不打印整个页面

[英]window.print() is not printing the whole page

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();" />

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. 当我点击打印按钮然后直到Email:tahir@7-cs.com页面打印。 It does not print the text below the scrollbar. 它不会打印滚动条下方的文本。

textBelowScrollbar

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? 我该怎么做?

Thanks 谢谢

you should use a separate css file for printing the page or use css3 media queries: 您应该使用单独的css文件来打印页面或使用css3媒体查询:

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

using percentage values its the best option when you create a css print file. 在创建css打印文件时,使用百分比值是最佳选项。

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

or in your main css file: 或在您的主css文件中:

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

use 使用

  body,html { margin-top:0%;
   display:block;
   height:100%;}

Try using CSS print stylesheets, have a look at google for some examples . 尝试使用CSS打印样式表,看看谷歌的一些例子

On why it actually doesn't print the whole page, I assume you're missing a setting on your print dialog that states how the printing will be done. 关于为什么它实际上不打印整个页面,我假设您在打印对话框中缺少一个设置如何完成打印的设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM