help please.. create pdf file from php code

Discussion in 'PHP' started by falcons, Dec 16, 2008.

  1. #1
    hello dear friends ... .
    i need a help for creating pdf file from php code with mysql database
    i found soem code from net ... but that is not run return me error ..

    <?php
    $mypdf = pdf_new();
    pdf_open_file($mypdf, "riz.pdf");
    pdf_begin_page($mypdf, 595, 842);
    $myfont = pdf_findfont($mypdf, "Times-Roman", "host", 0);
    pdf_setfont($mypdf, $myfont, 10);
    pdf_show_xy($mypdf, "There are more things in heaven and earth, Horatio,", 50, 750);
    pdf_show_xy($mypdf, "than are dreamt of in your philosophy", 50, 730);
    pdf_end_page($mypdf);
    pdf_close($mypdf);
    pdf_delete($mypdf);
    ?>


    this code return me error ...
    Fatal error: Call to undefined function pdf_new() in c:\wamp\www\exemples\phpinfo1.php on line 2

    help me please what i will do ...
     
    falcons, Dec 16, 2008 IP
  2. Yesideez

    Yesideez Peon

    Messages:
    196
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Create a NEW file call it something like "servertest.php" and have this:
    <?php
      phpinfo();
    ?>
    Code (markup):
    Then run it and check the output - you might not have the PDF library installed on your server.
     
    Yesideez, Dec 16, 2008 IP
  3. geekranger

    geekranger Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    most likely you don't have the extension to use this function.

    or maybe you need to uncomment or add in the extension_dir="...." in the .ini file.

    like what Yesideez say - do a phpinfo() check
     
    geekranger, Dec 16, 2008 IP
  4. falcons

    falcons Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    please dear .... tel me how i install pdf library...
     
    falcons, Dec 16, 2008 IP
  5. falcons

    falcons Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    please let me know .. how i add PDF library..
     
    falcons, Dec 16, 2008 IP
  6. olddocks

    olddocks Notable Member

    Messages:
    3,275
    Likes Received:
    165
    Best Answers:
    0
    Trophy Points:
    215
    #6
    olddocks, Dec 16, 2008 IP
  7. falcons

    falcons Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    dear i had download some scripts from your advised site...

    html 2 fpdf file ...
    but do not know how to use it ..

    there is some data get from mysql and display in HTML page ... i want that page in PDF file .... or if any way how to get from database and make in pdf file ... just like i export data from mysql and i make a csv file ...
     
    falcons, Dec 18, 2008 IP
  8. herbacious

    herbacious Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    fpfd is the way i would do this
     
    herbacious, Dec 19, 2008 IP
  9. falcons

    falcons Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    please help me dear .. i will thankful to you ...
     
    falcons, Dec 20, 2008 IP
  10. falcons

    falcons Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    i found a class html2pdf ...
    but i dont know how to use it .. please help me ...
     
    falcons, Dec 20, 2008 IP