我正在使用barryvdh/laravel-Snappy创建和下载pdf文件,如下所示.由于数据表太长,它向下到了第二页,但失go 了顶部的行数.我怎么才能修好它呢? example images个
我正在使用barryvdh/laravel-Snappy创建和下载pdf文件,如下所示.由于数据表太长,它向下到了第二页,但失go 了顶部的行数.我怎么才能修好它呢? example images个
标记内的内容将被视为表的正文:
<table>
<thead>
<tr>
<th>Header 1</th>
<th>Header 2</th>
// ...
</tr>
</thead>
<tbody>
// ...
</tbody>
<tfoot>
//...
</tfoot>
</table>
使用以下css样式可确保节中的页眉在每一页上重复:
thead {
display: table-header-group;
}
tfoot {
display: table-footer-group;
}
tr {
page-break-inside: avoid;
}
确保在生成PDF时使用适当的页面尺寸和页边距,以确保内容不会被切断:
$pdf = PDF::loadView('your.view', $data)
->setOption('margin-top', 30)
->setOption('margin-bottom', 30);