We're using wkhtmltopdf to convert some of our HTML pages to PDFs. wkhtmltopdf doesn't give much control over where the pages break resulting in some rather nasty-looking page breaks like in the image:


I had hoped to fix it with something like this:

@media print
#manualContent h2 {page-break-before:always;}
However, that's not doing a thing. Does anyone know how to do this? We're doing a 200+ page manual that will be updated fairly frequently so to try to catch the bad page breaks and change the HTML by hand before creating the PDF each time isn't really feasible.