'Prevent blank space in pdf pages (DomPdf)

I don't want to leave blank spaces or leave only the minimum possible in pdf. I noticed that the tag is only inserted on the page when all its content fits on the page, otherwise it advances to the next page. I have using DOMPDF lib to generate this pdf.

Pdf sample Blade component



Solution 1:[1]

You can give the PDF width and height and remove the margins to move it up.

@page {size: 600px 900px; margin:0!important; padding:0!important}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Joao Daniel