html2fpdf HTML转换为PDF

下载html2fpdf包:

downurl:http://sourceforge.net/projects/html2fpdf/

测试下:

require('html2fpdf.php');
$pdf=new HTML2FPDF();
$pdf->AddPage();
$fp = fopen("sample.hml","r");
$strContent = fread($fp, filesize("sample.html"));
fclose($fp);
$pdf->WriteHTML($strContent);
$pdf->Output("sample.pdf");
echo "PDF file is generated successfully!";

你可能感兴趣的:(php)