Laravel-dompdf set custom paper size
Often, many web application required functions like export to pdf, but not all the time is A4 paper size.
I’m using laravel-dompdf for the project. I will not talk about the setup. Let’s see the code directly.
The code above, will generate & download the pdf file in A4 paper size. But what if different paper size is needed?
You can set the paper size to any size you want
$pdf->setPaper([0, 0, 685.98, 396.85], 'landscape');
(Bare in mind that the value is in point unit)
You can measure the paper with your ruler.
But what you measure is in centimeter (cm) or millimeter (mm), so you can ask google to convert the unit for you