Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    May 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    MySQL data to PDF using PHP

    Good Evening All,

    I have a task that involves a user inputting data into MySQL through a simple HTML form, but then after saving the data, the user must be able to click a button and for that record that they just saved, be able to display those values on a pdf that I will scan in into the computer...

    Any ideas on how to get the MySQL data onto a PDF, simply by inserting data?

    Thanks!

  • #2
    New Coder
    Join Date
    Mar 2008
    Location
    Somerset, England
    Posts
    93
    Thanks
    0
    Thanked 10 Times in 10 Posts
    Here are the absolute basics for creating a PDF file. I would recommend reading the PHP.net pdf manual pages for more information.

    PHP Code:
    <?php
    $pdf 
    PDF_new(); // Start working with a pdf
    PDF_open_file($pdf'/path/to/your.pdf'); // Creates a new pdf at the specified location
    $font PDF_findfont($pdf'Times-Roman''host');

    PDF_begin_page($pdf595842); // Starts a new page of given x y dimensions
    PDF_show_xy($pdf'Text to be written'50750); // 50, 750 is cursor position
    PDF_end_page($pdf);

    PDF_close($pdf); // Closes the $pdf resource
    PDF_delete($pdf); // Does not delete the pdf just the memory resource
    ?>

  • #3
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    I recommend http://www.fpdf.org Take a look at the tutorials, scripts, manual, and forum. It's much easier than the php manual.



    -----------------
    Leonard Whistler


  •  

    Posting Permissions

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