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

百般思念 提交于 2020-02-19 09:56:13

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/25376901/how-to-set-custom-width-and-height-of-pdf-using-dompdf

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!