使用wkhtmltopdf转换为PDF时,表头在第二页重叠



我有一个跨多个页面的表。标题在第二页重复,并且与内容重叠。

我正在使用bootstrap,并确保其他wkhtmltopdf重叠解决方案的css在我的页面中实现。

thead { display: table-header-group; }
tfoot { display: table-row-group; }
tr { page-break-inside: avoid; }
table, tr, td, th, tbody, thead, tfoot, td div {
    page-break-inside: avoid !important;
}

表被<div class="table-responsive">包裹。

我添加了以下CSS来更改表响应div

上的overflow-x处理方式
.table-responsive { overflow-x: visible !important; }

这个修复了我的问题。

基斯

这对我来说很有效。表中:

<table class="webgrid-table">
 <thead>
  <tr>
   //your code
  </tr>
 </thead>
</table>

只添加以下CSS类:

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

要补充一点,有时这是一个溢出的问题。

.table-responsive { overflow-x: visible !important; }

解决了一次,但有时问题是,例如身体,等等

.table-responsive, .table, body { overflow-x: visible !important; }

在我的例子中,是代码体出现了奇怪的溢出。

有funsies

最新更新