如何通过在PHP中使用html2pdf手动更改pdf的高度和宽度 [英] how to change height and width manually of pdf by using html2pdf in php

查看:568
本文介绍了如何通过在PHP中使用html2pdf手动更改pdf的高度和宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用html2pdf将html转换为pdf ...实际上,我有一个很大的html容器,例如12x12in(英寸). 并且我第一次使用A4尺寸,然后我的html内容直到按照尺寸(12x12英寸)才完全显示出来,然后我调查了您的网站,并在这里找到了所有纸张尺寸. 但是现在,当我使用A3尺寸时,我发现pdf文件中的所有html内容....但是我的pdf内容底部有太多空间... 所以我想知道...有没有办法从pdf减少此空间,或者有其他任何方法将html转换为具有手动定义的页面高度和宽度的pdf ...

i am using html2pdf to convert html to pdf... actually i have a large size of html container like 12x12in (inches). and i have used A4 size for the first time then my html content not showing completely till as per the size (12x12 in) then i have look into your site and i found all paper size here.. thanks for that important info... but now, when i have used A3 size i have found, my all html content inside the pdf file....but there are so much space at the bottom of my contents in pdf... So i want to know... IS there any way to reduce this space from the pdf or any other way to convert html to pdf with manually defined page height and width...

预先感谢.

推荐答案

HTML2PDF 类的构造函数表示,$format参数与 tcpdf中的参数相同类. tcpdf 类的构造函数说明$format参数:

The constructor of the HTML2PDF class says, that the $format parameter is the same as in the tcpdf class. The constructor of the tcpdf class says about the $format parameter:

@param混合$format 用于页面的格式.它可以是以下值之一(不区分大小写),也可以是包含宽度和高度的两元素数组形式的自定义格式(以单位给定的单位表示)...

@param mixed $format The format used for pages. It can be either one of the following values (case insensitive) or a custom format in the form of a two-element array containing the width and the height (expressed in the unit given by unit) ...

稍加计算,就可以将页面大小设置为12''x 12''.默认单位是毫米.

With a little bit of calculation, this make it possible to set the page size to 12'' x 12''. The default unit is millimeters.

这篇关于如何通过在PHP中使用html2pdf手动更改pdf的高度和宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆