0

I want to create multiple pdf files using loop . I am putting code as below but only one file is generated and all data are written in that file only.How to generate multiple files.

My code is ..

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

$pli_ids=explode(",",$string);
foreach($pli_ids as $id)
{

    $data[]=array('inv_no'=>$inv_obj->invoice_number,'Work_order'=>'gandalf','data_type'=>$pli_obj->data_type_c_pl_c,'subscription'=>'subs1','hs_code'=>'hs1');
}
require_once ('include/pdf/class.ezpdf.php');
$pdf =& new Cezpdf();   
$pdf->selectFont('include/fonts/Helvetica.afm');

$pdf->ezSetY(750);
$pdf->ezText(date('d:M:Y'),14); $pdf->ezSetY(720);
$pdf->ezText('To,',14); $pdf->ezSetY(690);
$pdf->ezText('Mr. Kumar {contact Name}',14); $pdf->ezText('Kunal And Company Ltd {Account Name}',14);
$pdf->ezText('No 6, IInd Floor Marine Drive {contact shipping address}',14);$pdf->ezSetY(610);
$pdf->ezText('Mumbai, Pin: 560079',14); $pdf->ezText('Maharashtra',14);$pdf->ezText('Mob.:9977200030',14);
$pdf->ezSetY(550);
$pdf->ezText(' <c:uline>Sub.: Your order of Export Import News </c:uline> ',15);
$pdf->ezSetY(520);  
$pdf->ezText('Dear Mr. Kumar, {Customer Name}',14);
$pdf->ezSetY(490);
$pdf->ezText('Greetings for the day!.',14); $pdf->ezSetY(460);
$pdf->ezText('Thanks for being a valuable customer of Infodrive India,we have enclosed the data as follows.');
$pdf->ezSetY(430);  
$pdf->ezTable($data,array('inv_no'=>'Inv No.','Work_order'=>'Work Order non','data_type'=>'Data Type','subscription'=>'subscription','hs_code'=>'HS Code'),
    '',
    array('showHeadings'=>2,'shaded'=>1,'xPos'=>'right','xOrientation'=>'left','width'=>400));
$filename = "pdf_".$i;
$pdf->ezStream(array("Content-Disposition"=>$filename));

}
4

1 回答 1

0

您正在使用ezStream()将 pdf 发送到浏览器。您只能以这种方式发送一个文件。

于 2012-08-21T08:33:03.137 回答