I have a block of text like this:
<h2> This is heading</h2>
<p> This is a paragraph</p>
The page is breaking after the h2, and I want it to stick together with the following paragraph.
I have tried wrapping both elements in a html element (div, span), applying a class to them, and put this CSS in style tags at the beginning of the html to be printed in TCPDF:
page-break-inside:avoid
But it still breaks the page.
Other settings I have which may be relevant:
$pdf->SetAutoPageBreak(TRUE, 35);
Try this..
<p class="inline-object"><h2 class="inline-object">This is heading</h2> This is a paragraph</p>
Add CSS:
.inline-object{display:inline}