세 번째 행 이후에 page-break-before를 사용하여 pdf를 생성하면 디자인이 분해됩니다. 내 코드는 다음과 같습니다.
<!DOCTYPE html>
<html lang="en">
<head>
<title>DOM-PDF</title>
</head>
<body>
<table style="width:100%;">
<thead>
<tr>
<th>Serial</th>
<th>Name</th>
<th>Roll</th>
<th>Info</th>
</tr>
</thead>
<tbody>
@php
$n = 0;
for($i=0;$i<10;$i++){
@endphp
<tr style="text-align:center;">
<td>1</td>
<td>Rashedul Hasan</td>
<td>1208039</td>
<td>I am an employee.</td>
</tr>
@php
if($n==3){
echo "<i style='page-break-before:always;'></i> ";
}
$n++;
}
@endphp
</tbody>
</table>
</body>
</html>
이것은 2 페이지의 PDF보기입니다.
2 페이지에서 두 번째 행은 오른쪽으로 이동합니다. 그것을 고치는 방법?
chunks
테이블을 깨뜨리는 대신 사용 하는 것은 어떻습니까?
{{-- Replace collect()->times(10) with a collection when you're getting the actual data from DB --}}
@foreach (collect()->times(10)->chunk(3) as $chunk)
<table style="width:100%;">
<thead>
<tr>
<th>Serial</th>
<th>Name</th>
<th>Roll</th>
<th>Info</th>
</tr>
</thead>
<tbody>
@foreach($chunk as $result)
<tr style="text-align:center;">
<td>{{ $result }}</td>
<td>Rashedul Hasan</td>
<td>1208039</td>
<td>I am an employee.</td>
</tr>
@endforeach
</tbody>
</table>
<i style='page-break-before:always;'></i>
@endforeach
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다