Laravel Snappy: Excess page

1.2k Views Asked by At

In our application we implemented the laravel snappy for the export pdf. Everything is okay(i managed to export, getting all the values) except that I having an excess blank page.

Controller

$pdf = PDF::loadView('registrations.export.export-pdf', $data)->setOption('footer-right','"page [page] of [topage]"');
return $pdf->stream('invoice.pdf');

Question: Why I have an excess blank page?

1

There are 1 best solutions below

0
Angel On

The reason it gives me an excess page because of the following css I have used in creating a page break number.

Custom css

.page{
        page-break-after: always;
        page-break-inside: avoid;
}

So what I did, I changed the page into

Custom css

.page {
    overflow: hidden;
    page-break-after: always;
}
.page:last-of-type {
    page-break-after: auto
}