'Rowspan in Nested Foreach Table in Laravel DOMPDF
I tried to generate PDF using barryvdh/laravel-dompdf in Laravel 8. My table is using rowspan. I could generate the PDF successfully, but it's not build the rowspan correctly on the page break like this. This only happened on the last two page. I already tried to setting my CSS and style, used page-break-after:always; , and $loop->iteration but it's still didn't work. This is my code:
View:
<tbody>
@foreach($sasarans as $i => $sasaran)
@foreach($sasaran->indikator as $indikator)
@foreach($indikator->pertanyaan as $pertanyaan)
<tr style="margin-top:-20px; margin-bottom:-25px;">
//Some data here
@foreach($pertanyaan->data_laporan as $data)
//Some data
@if($loop->iteration % 15 == 0)
<div class="page-break"></div>
@endif
@endforeach
</tr>
@endforeach
@endforeach
@endforeach
</tbody>
CSS:
.page-break {
display:block;
page-break-after: always;
}
Please help me because I'm still a beginner. Thank you for your help.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
