SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Thread: Creating pdf file emailing

  1. #1
    SitePoint Addict lmasi02's Avatar
    Join Date
    Aug 2004
    Location
    Zambia
    Posts
    257
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Creating pdf file emailing

    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

  2. #2
    SitePoint Enthusiast
    Join Date
    Jul 2008
    Posts
    58
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I use Primo for my pdf program...what DB program are you using?
    Dewey
    DedicatedNow.com
    Servers from $49.95!

  3. #3
    SitePoint Addict lmasi02's Avatar
    Join Date
    Aug 2004
    Location
    Zambia
    Posts
    257
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    mysql Db
    Power of Knowledge

  4. #4
    SitePoint Addict lmasi02's Avatar
    Join Date
    Aug 2004
    Location
    Zambia
    Posts
    257
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Power of Knowledge

  5. #5
    SitePoint Addict
    Join Date
    Sep 2004
    Location
    seattle
    Posts
    306
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you can use fpdf.org, i'm usinging to email dynamically generated pdf reports to users.

  6. #6
    SitePoint Addict lmasi02's Avatar
    Join Date
    Aug 2004
    Location
    Zambia
    Posts
    257
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wakk0 View Post
    you can use fpdf.org, i'm usinging to email dynamically generated pdf reports to users.
    Hi Wakk0,
    Kindly walk me thru how you are doing it. i need to create a pdf from mysql db and email it to the client as an invoice.

    Anyone with ideas on how i can create an invoice in pdf using php. i.e draw the table, insert the data and the like
    Power of Knowledge

  7. #7
    SitePoint Addict
    Join Date
    Sep 2004
    Location
    seattle
    Posts
    306
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •