pdf report with fpdf onthefly (problem with rowspan solved)

nah mungkin bagi anda yg ingin membuat report dengan fpdf akan menemui kesulitan pada saat table itu berbentuk rowspan. tapi ada solusi jika anda membuat data report itu sebagai table lalu baru melakukan print setelah data menjadi sebuah table.

sebagai contoh seperti gambar dibawah

nah dengan mengunakan library dari

http://www.vanxuan.net/tool/pdftable/

 


include 'unserialize.php';

function genRandomString() {
$length = 10;
$characters = "0123456789abcdefghijklmnopqrstuvwxyz";
$string = '';

for ($p = 0; $p < $length; $p++) {
$string .= $characters[mt_rand(0, strlen($characters))];
}

return $string;
}


$unsrt = new unserialize();
if(isset($_REQUEST['tanggal'])){
$tanggal=$_REQUEST['tanggal'];}
else $tanggal ='';
$arr = $unsrt->get_report_harian($tanggal);

$table1 = "<table border='1'>";
$table1 .= "<tr>";
$arr_name =array_keys($arr[0]);
foreach ($arr_name as $name){
if ($name== 'isi'or $name=='userorganizationid'){
}else{
$table1 .= "<td>".$name."</td>";
}
}
$table1 .="</tr>";
foreach ($arr as $arr_list){
$table1 .="<tr style='font-size: 11'>";
foreach ($arr_name as $name2){
if ($name2== 'isi'or $name2=='userorganizationid'){
}else{
$table1 .="<td>".$arr_list[$name2]."</td>";
}
$table1 .="</tr>";
}

}
$table1 .= "</table>";
define('FPDF_FONTPATH','font/');
require('lib/pdftable.inc.php');
$p = new PDFTable('L');
$p->AddPage();
$p->setfont('times','',9);
$p->SetMargins(10,10,10);
$p->htmltable($table1);
$name = genRandomString();
$p->output('pdf/LaporanHarian'.$name.'.pdf','F');

itu contoh dari source code. didalam source code itu terdapat unserialize function yg dibuat oleh mas azani hs.

 

sorry article tidak lengkap males nulis.

 

2 thoughts on “pdf report with fpdf onthefly (problem with rowspan solved)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s