DOMPDF中的自定义宽度和高度 [英] Customized width and height in DOMPDF
问题描述
我是否可以设置生成的PDF的宽度和高度?我想自定义PDF的宽度和高度。通常情况下,它是在短证券纸的尺寸上,但是我如何对其进行定制?可以说,例如,我希望尺寸为200 x 500像素吗?
Is there anyway i can set the generated PDF's width and height? i want to customized the width and height of the PDF. Normally it would be on a size of a short bond paper but how can i customized it? lets say for example i want it to be 200 x 500 pixel in size?
任何想法都将不胜感激!欢呼!
Any idea would be very much appreciated! cheers!
推荐答案
您可以在调用时通过传递数组来设置自己的格式,而不必更改DOMPDF代码。 DOMPDF :: set_paper()。确保它包含以点为单位的宽度和高度,例如:
You can set your own format, without having to change DOMPDF code, by passing an array when you're calling DOMPDF::set_paper(). Make sure it contains the width and the height in points, like this:
$ dompdf-> set_paper(array(0,0,595 ,841),'portrait');
这篇关于DOMPDF中的自定义宽度和高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!