How can I adjust the position of the signature to be more dynamic (laravel dompdf)?

705 Views Asked by At

My controller is like this :

public function listdata(Request $request)
{
    ...
    $pdf = PDF::loadView('test_print.test', ['data' => $data]);
    $pdf->setPaper('legal', 'landscape');
    return $pdf->stream('test_print.test');
}

My pdf view is like this :

<h1>This is test</h1>

<table class="tg">
    <tr>
        <th class="tg-3wr7">kolom 1</th>
        <th class="tg-3wr7">kolom 2</th>
        <th class="tg-3wr7">kolom 3</th>
        <th class="tg-3wr7">kolom 4</th>
        <th class="tg-3wr7">kolom 5</th>
    </tr>
    @php ($row = 22)
    @for($i=0;$i<$row;$i++)
    <tr>
        <td class="tg-rv4w">test 1</td>
        <td class="tg-rv4w">test 1</td>
        <td class="tg-rv4w">test 1</td>
        <td class="tg-rv4w">test 1</td>
        <td class="tg-rv4w">test 1</td>
    </tr>
    @endfor
</table>

<br>
<!-- start position signature -->
<div class="signature">
    London,&nbsp;8 January 2017<br>
    Chelsea Player<br><br><br><br>
    Eden Hazard<br>
</div>
 <!-- end position signature -->

The result is like this : enter image description here

It looks content of a signature separate to 2. There are at page 1 and there are at page 2

I want to make the results look like this : enter image description here

how I do it?

1

There are 1 best solutions below

2
On

From DOMPDF docs:

Page breaks can be inserted by applying the CSS properties page-break-before and page-break-after to any block level element.

So insert class with defined property and use this class. For testing you could just insert something like this instead of <br>:

<div style="page-break-before: always;"></div>