Search code examples
phpfpdf

Loops in FPDF library


I am new to using FPDF and cant get my head around it. Here is the simple case:

$pdf = new FPDF();
$pdf->AddPage();


for($i=0; $i< 10; $i++){

    $pdf->SetFont('Arial', "B", 12);
    $pdf->Cell(40, 10, "asd");


}
$pdf->Output();

The browser says it failed to load PDF document. whats wrong?


Solution

  • Well the code itself works for me. As stupid as it might sound, did you include the fpdf.php?

    require('your/dircetory/fpdf.php');