【发布时间】:2013-08-27 14:08:35
【问题描述】:
我正在使用 PHP 和 HTML2PDF 库来生成 pdf 文件。但我想要做的是生成一个 pdf 文件,其中 pageSize(宽度/高度)作为 html 内容大小。我怎样才能做到这一点?
我的html内容是:
<page format="432x240" orientation="L" backcolor="#FFFFFF" style="font: arial;">
<div class="image">
<span class="firstname">$fname</span>
<span class="lastname">$lname</span>
</div>
图片类的css是:
position: relative;width: 100%; /* for IE 6 */ background-image: url(../img/test.png);height: 240px; width: 432px;top: 50%;
而我的 PHP 代码是:
$html2pdf = new HTML2PDF('P', 'A4', 'en', true, 'UTF-8', 0);
$html2pdf->pdf->SetDisplayMode('fullpage');
$contentTpl = $this->renderPartial('template_01', array('fname' => $firstname, 'lname' => $lastname), true);
$html2pdf->writeHTML(utf8_encode($contentTpl));
【问题讨论】: