如何使用“page-break-inside”对于 tbody 标签?

发布于 2025-01-21 03:44:20 字数 1312 浏览 2 评论 0原文

我有一个使用 wkhtmltopdf 工具转换为PDF的HTML文件。 我正在使用页面break-inside:避免样式以逃脱页面包装(如果表格上没有位置的表格,则整个表格为新的PDF页面),并且它非常适合桌子。

问题是

我有这样的

 <table >
    <caption>Payments</caption>
    <tbody>
        <tr>
            <th>line 1</th>
            <td>100.00</td>
        </tr>
        <tr>
            <th>line1 note 1</th>
            <td>120.00</td>
        </tr>
         <tr>
            <th>line1 note 2</th>
            <td>20.00</td>
        </tr>
    </tbody>
    <tbody>
        <tr>
            <th>line 2</th>
            <td>100.00</td>
        </tr>
        <tr>
            <th>line2 note 1</th>
            <td>120.00</td>
        </tr>
         <tr>
            <th>line2 note 2</th>
            <td>20.00</td>
        </tr>
    </tbody>
</table>

表不在桌子旁。我希望新的Tbody块从新页面开始(而不是在当前页面上没有位置,而不是在Tbody Block内部开始)。

I have an HTML file that I convert to PDF using the Wkhtmltopdf tool.
I am using page-break-inside: avoid style to escape table wrapping in pages (if there is no place on the current page for the table the whole table goes to a new pdf page), and it works great for tables.

The question is

I have this kind of table

 <table >
    <caption>Payments</caption>
    <tbody>
        <tr>
            <th>line 1</th>
            <td>100.00</td>
        </tr>
        <tr>
            <th>line1 note 1</th>
            <td>120.00</td>
        </tr>
         <tr>
            <th>line1 note 2</th>
            <td>20.00</td>
        </tr>
    </tbody>
    <tbody>
        <tr>
            <th>line 2</th>
            <td>100.00</td>
        </tr>
        <tr>
            <th>line2 note 1</th>
            <td>120.00</td>
        </tr>
         <tr>
            <th>line2 note 2</th>
            <td>20.00</td>
        </tr>
    </tbody>
</table>

where each block is tbody inside one big table, as the block can be too long and it can be bigger than one pdf page I want to wrap it by tbody, not by the table. I want the new tbody block to start from the new page (instead of cutting inside tbody block) if there is no place on the current page.
enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文