title: How to push the title of the content to the next page in PDF
body: <p>I have coded PHP script to generate PDF with text contents using TCPDF library. First, the script gets the contents from database and creates temporary .html file. Then the script gets the contents from the .html file and writes to create PDF document.</p>
  
  <p>However, the problem here is it doesn't know when to break a page. So, it looks something like in the image.</p>
  
  <p>I want the script to break the page when the title comes at the bottom of the page and move it to the next page.</p>
  
  <p>There is a function called $pdf->AddPage(); that breaks the page.</p>
  
  <p>Is there any solution to this? Please help.</p>
  
  <p><a href="https://i.stack.imgur.com/wFhIa.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wFhIa.jpg" alt="Picture sample"></a></p>