php DOMPDF 卡在信纸尺寸上
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17681044/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
DOMPDF Stuck on Letter Paper Size
提问by Deej
I'm using DOMPDF on a little web app I'm building. It's working great apart from it's stuck on the default paper size of 'US Letter' no matter where I change it.
我正在构建的一个小网络应用程序上使用 DOMPDF。除了无论我在哪里更改它都停留在“美国信函”的默认纸张尺寸上之外,它运行良好。
Any ideas?
有任何想法吗?
// dompdf_config.inc.php
def("DOMPDF_DEFAULT_PAPER_SIZE", "a4");
回答by Tom Metcalfe
Are you correctly calling the 'set_paper' method in your pdf creation as follows :
您是否正确调用了 pdf 创建中的“set_paper”方法,如下所示:
$dompdf->set_paper(DEFAULT_PDF_PAPER_SIZE, 'portrait');
Furthermore, you can define your own paper size if this is still not working using something along the lines of the following :
此外,如果使用以下内容仍然不起作用,您可以定义自己的纸张尺寸:
$paper_size = array(0,0,360,360);
$dompdf->set_paper($paper_size);
回答by zzapper
The above did not help me still stuck on Letter The following did work (from DOMPDF FAQ)
以上并没有帮助我仍然停留在 Letter 以下确实有效(来自 DOMPDF FAQ)
$dompdf->set_paper("A4", "portrait");