Log in

View Full Version : FPDF Table dengan multipage


Linuxmania
20th November 2011, 01:13 AM
agan2 yang ganteng.



Ane selalu mengalami error pas buat page baru pada fpdf.



ni kodenya




PHP Code:




$headerText = array('No.','Text');

$columns = count($headerText);



$pdf = new fpdf_table;



$no = 0;



foreach($items as $item){



if($no == 20){

$no = 0;

}



if($no == 0){

$pdf->AddPage();

//Table Header

for($i=0; $itbSetHeaderType($aSimpleHeader);



//Draw the Header

$pdf->tbDrawHeader();

}

$no++;

// No. Urut

$data[0]['TEXT'] = $no;

$data[0]['T_ALIGN'] = "C";//default in the example is C



// Nama Barang

$data[1]['TEXT'] = "Text ".$no;

$data[1]['T_ALIGN'] = "L";



$pdf->tbDrawData($data);

}



//output the table data to the pdf

$pdf->tbOuputData();



//draw the Table Border

$pdf->tbDrawBorder();



$pdf->output("test.pdf","I");








Jadi pas 20 item, langsung membuat halaman baru.

tapi Tablenya hanya kebentuk pas halaman berikutnya, pada halaman pertama table tersebut hilang. :((



Please..

</div>