Issue
I am using barryvdh/laravel-snappy to create and download pdf files as shown below. Because the data sheet was too long, it went down to the second page but lost the lines at the top. How can I fix it? example images
Solution
The content inside the tag will be treated as the body of the table:
<table>
<thead>
<tr>
<th>Header 1</th>
<th>Header 2</th>
// ...
</tr>
</thead>
<tbody>
// ...
</tbody>
<tfoot>
//...
</tfoot>
</table>
Use the following CSS styles to ensure that the headers in the section are repeated on every page:
thead {
display: table-header-group;
}
tfoot {
display: table-footer-group;
}
tr {
page-break-inside: avoid;
}
Make sure that when you're generating the PDF, you're using appropriate page dimensions and margins so that the content doesn't get cut off:
$pdf = PDF::loadView('your.view', $data)
->setOption('margin-top', 30)
->setOption('margin-bottom', 30);
Answered By - Jeyhun Rashidov
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.