Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

{page-break-after: always} not working when printing

EDIT: I just noticed this works in IE9, but not IE10 and Chrome.

We receive HTML formatted PO reports from one of our suppliers electronically. We usually print these and before it would put 1 PO per page, but now it is not adding the page breaks. I checked the html and I can't see why it wouldn't work all of a sudden. This is the (poorly formatted) html:

<HEAD>
<STYLE TYPE='text/css'><!--
BR.breakhere {page-break-after: always}
.tb1{font:10pt Arial;}
.tb2{border-left:1px solid #000000; border-right:1px solid #000000;border-top: 1px  solid #000000;border-bottom: 1px solid #000000;}
.tb3{font:10pt Arial;border-left:1px solid #000000; border-right:1px solid #000000;border-top: 1px  solid #000000;border-bottom: 1px solid #000000;}
.tb4{font-size:8pt;}
--></STYLE>
</HEAD>

The page break is suppose to occur here:

<BR class=breakhere>

It occurs immediately after a TABLE element, the TABLE has an HR after the last TR (ugh).

<BR><HR style = "width:100%;height:10px;color:#000000"></TABLE><BR class=breakhere>

I want to contact them and mention this but I'm not sure if it is the code or something on our end? I've tried every browser, multiple printers and workstations, but can't get it to break pages.

Thanks!

like image 641
ItsPronounced Avatar asked Jun 07 '13 17:06

ItsPronounced


People also ask

Why page-break is not working?

If manual page breaks that you add don't work, you may have the Fit To scaling option selected (Page Layout tab -> Page Setup group -> click Dialog Box Launcher Button image -> Page). Change the scaling to Adjust to instead.

How do you insert a page-break after always?

Note: The page-break-after property cannot be used on absolutely positioned elements or an empty <div> element. Syntax: page-break-after: auto|always|avoid|left|right|initial|inherit; Default Value : Its default value is auto.

Can I force a page-break in HTML printing?

You can use the CSS property page-break-before (or page-break-after ). Just set page-break-before: always on those block-level elements (e.g., heading, div , p , or table elements) that should start on a new line. Save this answer.

What is page-break printing?

Page breaks are dividers that break a worksheet into separate pages for printing. Microsoft Excel inserts automatic page breaks based on the paper size, margin settings, scale options, and the positions of any manual page breaks that you insert.


1 Answers

page-break is not enough for internet explorer by own. If u try this, you can see the result. I have same problem but I solved by this way.

<div style="page-break-after: always;"></div>
<div>&nbsp;
</div>
like image 156
Mumin Ka Avatar answered Nov 16 '22 00:11

Mumin Ka