Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set custom page size in mPDF? Mpdf version7

Tags:

php

mpdf

I am using mpdf library in PHP to create a pdf file from HTML. I need to set the page mode in Custom mode

like image 282
Ashikur Rahman Avatar asked Dec 12 '25 08:12

Ashikur Rahman


1 Answers

[mPDF 7.x] See format parameter and Example #2 on mPDF __construct documentation page:

// Define a page size/format by array - page will be 190mm wide x 236mm height
$mpdf = new \Mpdf\Mpdf(['format' => [190, 236]]);

The format is an array of width and height in millimeters.

like image 50
Finwe Avatar answered Dec 13 '25 21:12

Finwe