Hi
I creating a system that need to send invoices in pdf format via mail. i am able to send an email but have problems with creating a PDF from the DB data.
| SitePoint Sponsor |


Hi
I creating a system that need to send invoices in pdf format via mail. i am able to send an email but have problems with creating a PDF from the DB data.
Power of Knowledge
I use Primo for my pdf program...what DB program are you using?


mysql Db
Power of Knowledge


http://www.astahost.com/info.php/how...php_t4972.html
I got the data from the site
Power of Knowledge


you can use fpdf.org, i'm usinging to email dynamically generated pdf reports to users.


i wrote my php script as i normally would to get the results, then where i have my table headers i also have: <?
$pdf_cols = array("column headers seperated by ,");
$pdf_data = array();
?>
then where my results get displayed i have:
<?
$pdf_data[count($pdf_data)] = array(here your variables here);
?>
at my closing html tag:
<?
$pdf = new PDF("L");
$pdf->SetFont("Arial", "B", 14);
$pdf->AddPage();
// header
$pdf->Cell(200, 10, "Service Advisor Bonus Amounts", 0, 0, "L");
$pdf->Ln();
// sub-header
$pdf->SetFont("Arial", "", 10);
$pdf->Cell(200, 10, "From : ".$StartDate." to ".$EndDate, 0, 0, "L");
$pdf->Ln();
// table
$pdf->SetFont("Arial", "", 9);
$pdf->FancyTable($pdf_cols, $pdf_data);
$pdf->Output("pdf/".$filename);
?>
so when the user runs a report and click submit the pdf file will get created/saved to the pdf folder
then i have a send_mail script that will take that same pdf report and send it to the users.
there are tons of examples on fpdf.org under the scripts link...it's been a while so i don't remember which example i modified.
Bookmarks