0

I get from here : https://github.com/barryvdh/laravel-dompdf

Previous, I use PHP 7.0.8. My pdf no error

When I use PHP 7.1, my pdf exist error

See below

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 -->

When executed, there exist error like this :

1/1 ErrorException in Page.php line 494: A non-numeric value encountered

Why laravel-dompdf not working di php 7.1?

moses toh
  • 12,344
  • 71
  • 243
  • 443

1 Answers1

3

There is a known incompatibility between PHP 7.1.0 and Dompdf 0.7.0 and earlier. Please refer to issue #1272. Dompdf 0.8.0, released Feb 15 2016, addresses these issues.

BrianS
  • 13,284
  • 15
  • 62
  • 125
  • I use laravel-dompdf. No dompdf. Seems it different – moses toh Feb 13 '17 at 17:50
  • @mosestoh It's not different, the package is just a way to integrate `dompdf` into a framework. See [Laravel News](https://laravel-news.com/cashier-dompdf) for further clarification if needed. – camelCase Feb 13 '17 at 20:13
  • 1
    @camelCase, Ok. Means the conclusion I have to wait until there are updates? – moses toh Feb 13 '17 at 22:28
  • 1
    @mosestoh yep, that's an option. If that isn't an option for business reasons you could always rollback PHP to `7.0.8` until the upcoming `Dompdf` release is completed. – camelCase Feb 14 '17 at 00:05
  • @camelCase. Ok. Thanks. Seems I will use PHP 7.0.8 again – moses toh Feb 14 '17 at 00:12