SitePoint Sponsor

User Tag List

Results 1 to 25 of 39

Threaded View

  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2013
    Posts
    36
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Need help in converting PDF

    Here is my code, I included html2fpdf.php

    when I run this application, I am getting the following error.

    Code:
    "Fatal error: Call to undefined method HTML2FPDF::DisplayPreferences() in C:\xampp\htdocs\PHP_PDF\html2fpdf.php on line 155"
    PHP Code:
    <?php
    ob_start
    ();
    include 
    'DBConnect.php';
    require(
    "html2fpdf.php");

    $query "Select * from tb_php_sql";
    $result mysql_query($query);
    $string '<html><body><form>';
    $string .=  '<table border="1"><tr><th>ID</th><th>Name</th><th>Phone</th></tr>';
    while(
    $rowmysql_fetch_array($result))
    {
        
    $string .= '<tr><td>';
        
    $string .= '<td>'$row['id']. '</td>';
        
    $string .= '<td>'$row['Name']. '</td>';
        
    $string .= '<td>'$row['Phone']. '</td>';
        
    $string .= '</td></tr>';
    }
    $string .= '</table></form></body></html>';

    $string nl2br($string);
    echo 
    $string


    $toWrite ob_get_contents();
    ob_end_clean();
    $html = new HTML2FPDF();
    $html->AddPage();
    $html->WriteHTML($toWrite);
    $html->Output('pdfformat.pdf','I');

    ?>


    can any one help me out with sample php application, I am new to php..
    Last edited by cpradio; Jun 12, 2013 at 04:23. Reason: Added code/php tags


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
  •