dizzy1 Posted February 26, 2009 Share Posted February 26, 2009 php PDF_new table Hi Im trying to display a table using PHP's PDF SO far i got. It creates the pdf but not the table. <?php $myReport = " <table align='Center'> "; $myReport .= " <tr> "; $myReport .= " <td> "; $myReport .= " erer"; $myReport .= " </td>"; $myReport .= " </tr>"; $myReport .= " </table>"; $mypdf = PDF_new(); PDF_open_file($mypdf, ""); PDF_begin_page($mypdf, 595, 842); $myfont = PDF_findfont($mypdf, "Times-Roman", "host", 0); PDF_setfont($mypdf, $myfont, 10); PDF_show_xy($mypdf, "Sample PDF, constructed by PHP in real-time.", 50, 750); PDF_show_xy($mypdf, "$myReport ", 50, 730); PDF_end_page($mypdf); PDF_close($mypdf); $mybuf = PDF_get_buffer($mypdf); $mylen = strlen($mybuf); header("Content-type: application/pdf"); header("Content-Length: $mylen"); header("Content-Disposition: inline; filename=Fountain_Report.pdf"); print $mybuf; PDF_delete($mypdf); ?> Link to comment https://forums.phpfreaks.com/topic/147039-php-pdf-table/ Share on other sites More sharing options...
MadTechie Posted February 26, 2009 Share Posted February 26, 2009 thats because you sending HTML.. this is a PDF not a HTML page.. Options 1. use PDF_add_table_cell (example here http://uk.php.net/manual/en/function.pdf-fit-table.php) 2. try HTML2PDF Hope that helps Link to comment https://forums.phpfreaks.com/topic/147039-php-pdf-table/#findComment-771942 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.