I think you have three options: 1) Before printing, you can pre-calculate the print 2) While you are printing elements, check the Y position and compare it with the maximum Y position for the elements. If it is larger than the maximum, the footer is print and a Y position is Y for non-printable items. 3) Create an invisible box for each element and calculate how many of them fit into the page. Then you just need to separate the elements on the pages.
I hope my English is good enough.
Francisco goldenstein
source share