i use page-break-before: always in pdf success but when move the next page the table is not neat. what should I do next? 'Thanks'
this is my code:
.page-break{ page-break-before: always; }
<?php $e= 0 ?>
@foreach($dt as $data)
<?php $e++ ?>
<tr>
<td>{{$e}}</td>
<td>{{$data->part_number}}</td>
<td>{{$data->part_name}}</td>
<td>{{$data->model_name}}</td>
<td>{{$data->category}}</td>
<td>{{$data->request_qty}}</td>
</tr>
@if($e % 30 == 0)
<div class="page-break" ></div>
@endif
@endforeach
I tried in several ways, the only way i can make it work, was calculating a height. When you do a page break, must be in the end of table. Not is the best way, but works for me.
<table >
<thead>
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</thead>
<tbody>
@php($pixel=0)
@foreach($datos as $item)
@if($pixel >= 250)
@php($pixel = 0)
<table ><tbody>
@endif
<tr>
<td></td>
<td></td>
<td></td>
</tr>
@php($pixel +=10)
@if($pixel >= 250)
</tbody>
</table>
<div class="page-break"></div>
@endif
@endforeach
</tbody>
</table>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.