16

I have a page screenShot

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. 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

4

4 回答 4

7

您应该使用单独的 css 文件来打印页面或使用 css3 媒体查询:

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

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

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

或在您的主 css 文件中:

@media print {
      body, html, #wrapper {
          width: 100%;
      }
}
于 2012-06-01T06:53:06.657 回答
3

利用

  body,html { margin-top:0%;
   display:block;
   height:100%;}
于 2015-12-15T12:17:53.703 回答
1

使用这个 CSS

@media print{ 
    body, html, #page-container, .scrollable-page, .ps, .panel {
        height: 100% !important;
        width: 100% !important;
        display: inline-block;
    }
}
于 2021-08-29T08:53:21.263 回答
0

尝试使用 CSS 打印样式表,看看谷歌的一些例子

关于为什么它实际上没有打印整个页面,我假设您在打印对话框中缺少一个设置,该设置说明了如何完成打印。

于 2012-06-01T06:52:52.630 回答