Dynamic page break when printing (in table)

4

On a budget screen, I display the products registered within a Foreach in a table (each product), so in some cases, at the time of page printing the table gets broken and ends up getting very ugly on the print. I tested in my CSS the following:

@media print {
    table { 
        page-break-after: always; 
    }
}

But it breaks the page ALWAYS every time I have a table, but what I need is to break dynamically only when there is a page break. I also tested with 'auto' rather than 'always' and did not succeed.

How can I break only when Table breaks on the print screen?

EDIT: I searched in several places and so far I have not been able to resolve the dynamic page break, ie I only break the page when the table is broken.

A cruel doubt, why the 'self' does not work? Browser incompatibility? (chrome v36)

    
asked by anonymous 30.07.2014 / 15:44

2 answers

1

Are there any texts in the reports outside of the tables? Or are they just tables that you want to print? I have an example here only with multipage table, which worked perfectly, using only the css controls quoted above.

table { page-break-inside:auto }
thead { display:table-header-group }
tfoot { display:table-footer-group }

Remembering that the table should be structured correctly with all html tags accordingly.

References:

icul8r.

    
13.08.2014 / 16:48
0

It also worked with avoid .

Just put the CSS rule already mentioned above.

@media print{
    table{ page-break-inside:avoid; }
}
    
05.03.2015 / 20:32