我可以强制在HTML打印中跳转页面吗? [英] Can I force a page jump in HTML printing?

查看:195
本文介绍了我可以强制在HTML打印中跳转页面吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个可打印的HTML报告,并且它有部分应该从新页面开始。



有没有办法把一些东西放入HTML / CSS中,它会告诉浏览器它需要跳到一个新的页面?

我不需要这个工作在每个浏览器中,我想我可以告诉人们使用一组特定的浏览器来打印它。



感谢

Daniel

解决方案

添加一个名为pagebreak(或pb)的CSS类,如下所示:

  .pagebreak {page-break-before:always; } / * page-break-after works,以及* / 

然后添加一个空的DIV标签( 或任何生成框的块元素

 < div class =pagebreak> < / DIV> 

它不会显示在页面上,但会在打印时打乱页面。


I'm making a HTML report that is going to be printable, and it has "sections" that should start in a new page.

Is there any way to put something in the HTML/CSS that will signal to the browser that it needs to jump to a new page at that point?

I don't need this to work in every browser out there, I think I can tell people to use a specific set of browsers in order to print this.

Thanks
Daniel

解决方案

Add a CSS class called "pagebreak" (or "pb"), like so:

.pagebreak { page-break-before: always; } /* page-break-after works, as well */

Then add an empty DIV tag (or any block element that generates a box) where you want the page break.

<div class="pagebreak"> </div>

It won't show up on the page, but will break up the page when printing.

这篇关于我可以强制在HTML打印中跳转页面吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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