Daniel Magliola Daniel Magliola - 8 months ago 21
HTML Question

Can I force a page jump in HTML printing?

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.




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.