1

Hello there,

I'm trying to build a PDF file from a HTML file. I'm using this PHP code:
<?php
ob_start();
require_once(dirname(__FILE__).'/pdf/html2pdf.class.php');

$content = file_get_contents("template.php");

$html2pdf = new HTML2PDF('P','A4','en', true, 'UTF-8');
$html2pdf->pdf->SetDisplayMode('real');

$html2pdf->WriteHTML($content);
$html2pdf->Output('my_doc.pdf', 'D');
?>

I have tried to use $html2pdf->setDefaultFont('Times'); , but no success.

My HTML code is validated with W3's validator. Im using Adobe Reader 10.0.1 and the latest version of HTML2PDF (v4.01).

2

try to use table instead of div, for your header and footer.

for the gray class, "!important" must be remove, because html2pdf does not know it.
Ancien pseudo : lolo

3

Hello there,

Okay Spipu! Thanks for the information. I will convert the whole code to tables. (and also remove !important) Thanks again!

4

Thanks, seems to be working really good now.

But wasn't a copy of the HTML version, I'll try to convert px and % to mm instead.