Langkahnya:
1. Buatlah database di mysql dengan nama: logistic_db
2. Export file product.sql (sudah ada di file download)
3. Taruhnya semua folder tes_pdf di misal: C:/Program Files/xampp/htdocs
4. Buka Browser, ketik URL: //localhost/tes_pdf/print_pdf.php
contoh file print_pdf.php
include "connect.php";
include ('class.ezpdf.php');
$pdf = new Cezpdf('a4','landscape');
// Atur margin
$pdf->ezSetCmMargins(2, 3, 3, 3);
$pdf->addObject($all, 'all');
$pdf->closeObject();
$sql = mysql_query("SELECT * FROM product ");
$i = 1;
while($r = mysql_fetch_array($sql)) {
$data[$i]=array('No'=> $i,
'Id Product'=>$r[id_product],
'Name'=>$r[name],
'Price'=>$r[price],
'Detail'=>$r[detail]
);
$i++;
}
$pdf->ezStartText(100, 557, 12);
$pdf->ezStartText2(500, 557, 12);
$pdf->ezStartPageNumbers(35, 15, 10);
$pdf->ezTable($data, '', '', '');
$pdf->ezStream();
?>
0 komentar