'How to force a page-break on weasyprint?

I wonder if its possible to create a force break that splits the table rows? I think weasyprint does this in a sense but I want to break the rows in to specific counts (e.g 6 rows per page). Is that possible? I tried something like this:

<table>
    <tr>
        <th>Header1</th>
        <th>Header2</th>
    </tr>
    {% for d in data %}
        {% if forloop.counter == 6 %}
          <p style="page-break-before: always;"></p>
        {% endif %}
        <tr>
            <td>{{ d.name }}</td>
            <td>{{ d.age }}</td>
        </tr>
    {% endfor %}
</table>

but it just break each row in different pages. Any help would be appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source