Monday, December 24, 2007

FPDF library to create pdf files

we can create pdf files using php through fpdf library.. I have downloaded the fpdf library and created a pdf file with some images in it..

Here is my code which requires fpdf.php and array of image file name with full path, which u can download from the above link..

require('fpdf.php');
$pdf = new FPDF();
foreach($fileList as &$filename)
{
$pdf->AddPage();
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,substr(strrchr($filename,"/"),1));
$pdf->Image($filename,5,30,200,200,'jpg','');
}
$pdf->Output();
?>

No comments: