Hide table header if page has no rows with pagination (Flying Saucer)

Currently I have a dynamic table that is printed on multiple pages, and have a repeated header using Flying Saucer pagination.
The problem I am facing is if the table is too low at the bottom of the page, it just prints the table header and does not have any rows under it.

I am wondering how I can hide the header if there are no rows on the same page. The entire page is dynamic, so I cannot hardcode the table to go to the next page as I do not know how low the table will be.

table {
    width: 100%;
    -fs-table-paginate: paginate;
    border-spacing: 0;
<!-- lots of dynamic data, spans across multiple pages -->
    ~lots of data, rows  epeated multiple times dynamically

Archive from: https://stackoverflow.com/questions/59024900/hide-table-header-if-page-has-no-rows-with-pagination-flying-saucer

Leave a Reply

Your email address will not be published. Required fields are marked *