How to set custom width and height of pdf using dompdf?

后端 未结 1 916
一向
一向 2021-02-05 19:51

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 kind

相关标签:
1条回答
  • 2021-02-05 20:28

    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

    0 讨论(0)
提交回复
热议问题