Please How can I resolve this problem, I'm usinf PHP5. Here is my Codes.
$query = mysql_query("SELECT * FROM student_tb ORDER BY firstname ASC"); $count = 0; while($row = mysql_fetch_array($query)) { $count++; $output .= " <tbody> <tr> <td>$count</td> <td><img src='student_img/".$row['profile_picture']."' style='height:50px; width:50px;'></td> <td>".$row['firstname']."</td> <td>".$row['lastname']."</td> <td>".$row['class']."</td> <td>".$row['student_ID']."</td> <td>".$row['school_fees']."</td> <td>".$row['status']."</td> <td>".$row['content']."</td> <td>".$row['father_name']."</td> <td>".$row['father_phone']."</td> <td><center><a href=edit_student.php?id=".$row['id']."><span class='icon-edit'> Edit</span></a> | <a href=delete_student.php?id=".$row['id']."><font color='red'><span class='icon-trash'> Delete</span></font></a></center></td> </tr> </tbody>"; } return $output; } if(isset($_POST['create_pdf'])){ require_once("../tcpdf/tcpdf.php"); $obj_pdf = new TCPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $obj_pdf->AddPage(); $obj_pdf->SetCreator(PDF_CREATOR); $obj_pdf->SetTitle('SAINT PHILIP TECHNICAL SECONDARY SCHOOL'); $obj_pdf->SetHeaderData('','', PDF_HEADER_TITLE, PDF_HEADER_STRING); $obj_pdf->SetHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $obj_pdf->SetFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $obj_pdf->SetDefaultMonospacedFont('helvetica'); $obj_pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $obj_pdf->SetMargins(PDF_MARGIN_LEFT, '5', PDF_MARGIN_RIGHT); $obj_pdf->SetPrintHeader(false); $obj_pdf->SetPrintFooter(false); // or true $obj_pdf->SetAutoPageBreak(TRUE, 10); $obj_pdf->SetFont('helvetica', '', 12); $content = ''; $content .= ' <table class="table table-striped table-bordered table-hover" id="myTable" style="font-size:12px;"> <thead> <tr> <th>N<sup>o</sup></th> <th>Image</th> <th>First Name</th> <th>Last Name</th> <th>Class</th> <th>Serial N<sup>o</sup></th> <th>Fees /Frw</th> <th>Status</th> <th>Content</th> <th>Parent Name</th> <th>Contact</th> <th>Action</th> </tr> </thead> '; $content .= fetch_data(); $content .= '</table>'; $obj_pdf->writeHTML($content, true, 0, true, 0); $obj_pdf->Output("sample.pdf", "I"); } ?>
You have the line
return $output;
You should only do this if the PDF is not being created.
On 26 Dec 2017 10:13, "Ndayishimiye Muhamudu" muhamudu@users.sf.net wrote:
Please How can I resolve this problem, I'm usinf PHP5. Here is my Codes. $query = mysql_query("SELECT * FROM student_tb ORDER BY firstname ASC"); $count = 0; while($row = mysql_fetch_array($query)) { $count++; $output .= " <tbody> <tr> <td>$count</td> <td><img src='student_img/".$row['profile_picture']."' style='height:50px; width:50px;'></td> <td>".$row['firstname']."</td> <td>".$row['lastname']."</td> <td>".$row['class']."</td> <td>".$row['student_ID']."</td> <td>".$row['school_fees']."</td> <td>".$row['status']."</td> <td>".$row['content']."</td> <td>".$row['father_name']."</td> <td>".$row['father_phone']."</td> <td><center><a href=edit_student.php?id=".$row['id']."><span class='icon-edit'> Edit</span></a> | <a href=delete_student.php?id=".$row['id']."><font color='red'><span class='icon-trash'> Delete</span></font></a></center></td> </tr> </tbody>"; } return $output; } if(isset($_POST['create_pdf'])){ require_once("../tcpdf/tcpdf.php"); $obj_pdf = new TCPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $obj_pdf->AddPage(); $obj_pdf->SetCreator(PDF_CREATOR); $obj_pdf->SetTitle('SAINT PHILIP TECHNICAL SECONDARY SCHOOL'); $obj_pdf->SetHeaderData('','', PDF_HEADER_TITLE, PDF_HEADER_STRING); $obj_pdf->SetHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $obj_pdf->SetFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $obj_pdf->SetDefaultMonospacedFont('helvetica'); $obj_pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $obj_pdf->SetMargins(PDF_MARGIN_LEFT, '5', PDF_MARGIN_RIGHT); $obj_pdf->SetPrintHeader(false); $obj_pdf->SetPrintFooter(false); // or true $obj_pdf->SetAutoPageBreak(TRUE, 10); $obj_pdf->SetFont('helvetica', '', 12); $content = ''; $content .= ' <table class="table table-striped table-bordered table-hover" id="myTable" style="font-size:12px;"> <thead> <tr> <th>N<sup>o</sup></th> <th>Image</th> <th>First Name</th> <th>Last Name</th> <th>Class</th> <th>Serial N<sup>o</sup></th> <th>Fees /Frw</th> <th>Status</th> <th>Content</th> <th>Parent Name</th> <th>Contact</th> <th>Action</th> </tr> </thead> '; $content .= fetch_data(); $content .= '</table>'; $obj_pdf->writeHTML($content, true, 0, true, 0); $obj_pdf->Output("sample.pdf", "I"); } ?> TCPDF ERROR: Some data has already been output to browser, can't send PDF file https://sourceforge.net/p/tcpdf/discussion/435311/thread/fb7b5929/?limit=25#1b68 Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/tcpdf/discussion/435311/ To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
TCPDF ERROR: Some data has already been output to browser, can't send PDF file https://sourceforge.net/p/tcpdf/discussion/435311/thread/fb7b5929/?limit=25#1b68
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/tcpdf/discussion/435311/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/
Log in to post a comment.
Please How can I resolve this problem, I'm usinf PHP5.
Here is my Codes.
You have the line
return $output;
You should only do this if the PDF is not being created.
On 26 Dec 2017 10:13, "Ndayishimiye Muhamudu" muhamudu@users.sf.net wrote: