wkhtmltopdf thead重叠第二页上的内容

时间:2018-05-24 08:37:24

标签: html css wkhtmltopdf knp-snappy

以下是我的PDF结果的样子(请参阅第二页上的重叠标题):

enter image description here

代码是一个简单的HTML表,在一个TD元素中包含大量内容。

<table>
  <thead>
    <tr>
      <th>BESCHREIBUNG</th>
      <th>PREIS</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Lots of TEST's</td>
      <td>1,40 EUR</td>
    <tr>
  </tbody>
</table>

我知道已经有这个问题(以及其他一些问题):

wkhtmltopdf repeating thead headers overlapping content

那里的解决方案对我有用:

thead { display: table-header-group; }
tfoot { display: table-row-group; }
tr { page-break-inside: avoid; }

但是它仅适用于具有多行(tr)的表。

在我的情况下,如上所示,我有一个TD,其描述可能包含很多内容,因此一行将跨越多个页面。

对于这种特殊情况,是否也有解决方案?

1 个答案:

答案 0 :(得分:2)

如果将描述分成多个字符串数组,则可以使用该解决方案。并在tr中打印每个片段。

相关问题