简体   繁体   English

Google Chrome会打印额外的页面

[英]Google chrome prints extra page

I'm currently in the process of making a website (wordpress) print-friendly using css and on certain pages when printing on A4 it leaves a fully blank last page (see here for an example: http://takana.co.nz/?page_id=25 ). 我目前正在使用css制作一个适合打印的网站(wordpress),在A4上打印的某些页面上,它留下了一个完全空白的最后一页(请参阅此处的示例: http//takana.co.nz /?page_id = 25 )。

When simulating a print using Google Chrome's Developer Tools and the option "Emulate CSS media" I can't find anything that would be adding any more whitespace below the end of the content. 使用Google Chrome的开发人员工具和“模拟CSS媒体”选项模拟打印时,我找不到任何可以在内容末尾添加更多空格的内容。

The immediate conclusion is that something's adding whitespace beyond the footer text however I can't inspect element on a printed page to find it. 直接的结论是,有些东西会在页脚文本之外添加空格,但我无法检查打印页面上的元素以找到它。


What is causing the extra page when using print preview on chrome? 在chrome上使用打印预览时导致额外页面的原因是什么?

Use Following Code in css 在css中使用以下代码

 @media print {
     html, body {
        border: 1px solid white;
        height: 99%;
        page-break-after: avoid;
        page-break-before: avoid;
     }
}

See The Preview After Adding Css ; 请参阅添加Css后的预览;

在此输入图像描述

I try to print and it was one page, you can try add print break after- before avoid on ie footer 我尝试打印,这是一个页面,您可以尝试添加打印中断后 - 避免在页脚

@media print {
    footer {page-break-after: avoid;}
}

Seems issue is with the padding . 似乎问题在于padding Try to adjust padding for .entry-wrap for media print. 尝试调整.entry-wrap padding以进行媒体打印。

May be something like below 可能是下面的东西

@media print {
 .entry-wrap {
   padding: 25px; /* adjust it accordingly */
 }
}

Hope this will help you someway (y). 希望这对你有所帮助(y)。

In my case, this fairly heavy-handed solution worked: 就我而言,这个相当苛刻的解决方案有效:

@media print {
     html, body {
        height: 99%;
        overflow: hidden;
     }
}

Basically, you can simply force everything after the first page to be hidden. 基本上,您可以简单地强制隐藏第一页之后的所有内容。 Obviously you want to be pretty sure that you're not losing anything valuable. 显然你想要确定你没有失去任何有价值的东西。

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

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