When I create my pdf using dompdf it generates it as default width and height. I want to set custom width and height of my created pdf. If it is not possible in dompdf then kindly suggest some other plugin for php.
Just like the header, we will put our footer in a footer tag inside the body tag of the template. Just like header, we will create a space for our footer on every page then use part of the space for our footer. For the body content, put everything in a main tag inside the body tag of the template.
Using page-break-inside: auto; basically says to dompdf "do what you would normally do when breaking pages." To force a page break before / after your table you would use page-break-before: always; / page-break-after: always; . To ask dompdf to avoid breaking inside an element you would use page-break-inside: avoid; .
By default it's going to render on 'US Letter', you can change this by using:
$dompdf->set_paper(DEFAULT_PDF_PAPER_SIZE, 'portrait');
You can use 'letter', 'legal', 'A4', etc..
Nevertheless you can set your own size like this:
$customPaper = array(0,0,360,360);
$dompdf->set_paper($customPaper);
More info: https://github.com/dompdf/dompdf/wiki/Usage
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With