February 1, 2019

dompdf setPaper size orientation not working

According to the Usage page, in order to set the paper size and orientation you need to call setPaper(). However, this won't work if in your actual HTML you're rendering you have page size definition such as this:
    @page {
        margin: 0;
        padding: 0;
        size: 210mm 297mm;
    }
    html {
        margin: 0;
        padding: 0;
    }
    body {
        margin: 0;
        padding: 0;
    }
This will override whatever you set with setPaper(). Either remove it, or edit it.

No comments: