I had this tricky issue. I use php to generate html page, but when i save as pdf, each page leak into another page which i didnt like. I wanted a code which inserts page break in html code so that the pages print nicely one by one.

This code works nicely if you are looping html code in php. The printer should see the page breaks so as the pdf.

Here is this magic code.

[php]

<style type="text/css">

table { font: normal 12px arial,verdana ; padding:0; spacing:0 }
table,tr {
border: 1px solid #666;
}

}

@media all {
.page-break  { display: none; }
}

@media print {
.page-break  { display: block; page-break-before: always; }
}
</style>

[/php]

and where you want a page break, place this line.

[php]
<div class="page-break">
[/php]

Its that easy and simple!