I use barryvdh/laravel-dompdf
to generate PDF file. But I have issue when display long text on page PDF. My boss want the text will be on betweent two page if too long.
This is code in file view to generate PDF.
<div style="width: 100%; margin-top: 30px;">
<h2 style="font-family: yumindb">Test</h2>
<div class="div-table">
<div class="div-table-row">
<div class="div-table-col" style="width: 15%" align="center">Test</div>
<div class="div-table-col" style="width: 20%" align="center">Test</div>
<div class="div-table-col" style="width: 25%" align="center">Test</div>
<div class="div-table-col" style="width: 40%" align="center">Test</div>
</div>
@foreach($userNotes as $note)
<div class="div-table-row">
<div class="div-table-col" style="width: 15%" align="center">{{ $note->created_at }}</div>
@foreach($admin as $value)
@if($note->created_by === $value->id)
<div class="div-table-col" style="width: 20%" align="center">{{ $value->email }}</div>
@endif
@endforeach
<div class="div-table-col" style="width: 25%" align="center">{{ $note->note_title }}</div>
<div class="div-table-col" style="width: 40%" align="center">{{ $note->note_content }}</div>
</div>
@endforeach
</div>
</div>
This is css
.div-table {
display: table;
width: 100%;
border-collapse: collapse;
}
.div-table-row {
display: table-row;
}
.div-table-col {
display: table-cell;
border: 1px solid black;
padding: 10px;
}
I would like to have a part of text print in the first page in the available space and then continue to print the rest of the text in the next page. How can I do?
As of the current release, 0.8.4, Dompdf does not support splitting table cells/rows between pages. If the content of a cell is too large for the current page the entire contents will be moved to the next page.
Note that Dompdf will only page an element once. If an element will not fit on a page a second time Dompdf won't page it and just continue rendering on the current page.