There is data that is output in the form of a table of N pieces on each page, in the top of each page displays a small text, and followed by a table ie, page 1: the text table(rows 1-10) page 1: text table(line 11-21), ... .
The question how to break data into pages so that page is as complete as possible. Or at least how to know the page size when printing? Now I get 10 rows in the table, but if data is small, it remains a lot of space (even on 1-2 lines). It would have been easier if not for the text in the header, but alas it can not be removed - this printed form.