I am working on a Symfony2 project to create a PDF from an HTML view. Below is config.yml
knp_snappy: pdf: enabled: true binary: /path/to/my/wkhtmltopdf options: no-stop-slow-scripts: ~ enable-javascript: ~ use-xserver: ~ page-size: A4 dpi: 300
Now I want to know if the DIV overlaps at the edges of the page, if so add a page break before the DIV. It is currently displayed as follows.

I tried to get the height of the DIV and compare it with the height of the page, but that didn't work.
Is there any solution to find out when the DIV overlaps or the page automatically breaks when something overlaps?
source share