Page breaks when printing from browser

2

1

Is there any way to place page breaks when printing from my browser? I want to prevent that blocks of text get split at the wrong place.

Some background: I need to print drupal pages that list nodes (a node contains an item, an image and some text about that item). When I do a regular ctrl+p it happens most of the time that one node will be split over two pages. What I want to achieve is that I can place a page break after a node so that the next node will be printed on the next page.

It doesn't matter if I have to do it manually, any solution will be fine. Though I would prefer a browser addon. It also doesn't matter which browser will be used.

Simon Verbeke

Posted 2012-08-14T14:44:48.973

Reputation: 3 553

I don't think there's any way to do this but please update Q to specfify browser (chrome, safari, ie, fox, opera, ...) – RedGrittyBrick – 2012-08-14T15:58:36.027

@RedGrittyBrick Any browser would be fine. It just has to work :) – Simon Verbeke – 2012-08-15T19:21:32.100

Answers

2

If you can change the CSS used to format the page, See http://www.w3schools.com/cssref/pr_print_pagebi.asp

@media print
{
table {page-break-inside:avoid}
}

Obviously, replace table with whatever HTML element contains your node.

RedGrittyBrick

Posted 2012-08-14T14:44:48.973

Reputation: 70 632

That's brilliant! Let's hope I can get this to work in drupal. Will accept as soon as I can get it to work. – Simon Verbeke – 2012-08-15T19:22:10.697