I don't know why its not working. I've used while loop to generate multiple pdfs with ezpdf class, and only 1 pdf is creating. I also tried 'for loop' but is still the same . What should i do to achieve more than one pdf?
include ('class.ezpdf.php');
$limit = 1;
while($limit < 5){
$colw = array( 80 , 40, 220, 80, 40 );//column widths
$rows = array(
array('company','size','desc','cost','instock'),
array("WD", "80GB","WD800AAJS SATA2 7200rpm 8mb" ,"$36.90","Y"),
);
//x is 0-600, y is 0-780 (origin is at bottom left corner)
$pdf =& new Cezpdf('LETTER');
$total=0;
$curr_x=80;
$curr_y=600;
foreach($rows as $r)
{
$xoffset = $curr_x;
foreach($r as $i=>$data)
{
$pdf->setColor(0/255,0/255,0/255);
$pdf->addText( $xoffset, $curr_y , 10, $data );
$xoffset+=$colw[$i];
}
$curr_y-=20;
}
define('MY_FILENAME', 'testDoc'.$limit.'.pdf');
$pdfcode = $pdf->ezOutput();
$fp = fopen(MY_FILENAME, 'wb');
fwrite($fp, $pdfcode);
fclose($fp);
}