How to prevent a blank last page?

I repeat the list of objects. With each iteration, I create and populate a table containing the contents of one page.

I use CSS to add a page break after each table.

table { page-break-after: always; }

This works fine, except that I always get the last blank page. I assume this is due to the last iteration of the table using page break.

I tried.

table { page-break-after: always; }
table { page-break-after: auto; }
table { page-break-after: left; }
table { page-break-after: right; }

However, I always get this blank last page.

Is there any other way to insert page breaks that would not create a blank last page?
Or maybe some way to determine if the last iteration is, and not insert the last page break?

+5
source share
2

:

table:last-of-type {
    page-break-after: auto
}

, ,

body > *:last-child {
    page-break-after: auto
}
+12

ruby ​​ . css .

#publication_no_break{
/* stuff here */
page-break-after: avoid;
}

#publication_break{
/* stuff here */
page-break-after: always;
}

, ,

<% if page != total_pages %>
< .... .... id="publication_break" >
<% else %>
< .......... id="publication_no_break">
<% end %>

- , .

+2

All Articles