I am using mPDF to generate PDF files from form submissions. The script is going through all questions and creating a HTML fieldset for each containing the question and the answers.
Since the survey is quite long, the generated PDF spans over several pages which works fine. Now, the client wants "nice & pretty" PDF files, where a fieldset does not contain a page break.
From this question, I know I can determine the remaining space of a page during the generation process.
Now the question is, how can I determine the height of the fieldset coming up next in order to decide whether or not I have to add a page break first? Is there a function, which just renders a specific part of HTML as a PDF and returns the final height?