I use PHP and HTML2PDF lib to create pdf files. But I'm trying to create a pdf file with page size (width / height) as html content. How can I achieve this?
My html content:
<page format="432x240" orientation="L" backcolor="#FFFFFF" style="font: arial;"> <div class="image"> <span class="firstname">$fname</span> <span class="lastname">$lname</span> </div>
The css class for the image:
position: relative;width: 100%; /* for IE 6 */ background-image: url(../img/test.png);height: 240px; width: 432px;top: 50%;
And my PHP code:
$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));
Larry source share