1

I use php to make pdf documents.

Each document contains sections. Each section's length vary from document to document.
I want to detect section's heading position on a page before write it to the page.

I want to prevent ugly layout when a section's heading start on previous page (very near to the footer) and the content start on the next page (no room between the heading and the footer of previous page).

Thank you.