File manager - Edit - /home/custbahd/mediagepr.com/admin/comments/print_pdf.php
Back
<?php function generateRow(){ $contents = ''; include_once('db/connection.php'); $sql = "SELECT * FROM team"; //use for MySQLi OOP $query = $conn->query($sql); while($row = $query->fetch_assoc()){ $contents .= " <tr> <td>".$row['id']."</td> <td>".$row['name']."</td> <td>".$row['image']."</td> </tr> "; } return $contents; } require_once('tcpdf/tcpdf.php'); $pdf = new TCPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf->SetCreator(PDF_CREATOR); $pdf->SetTitle("Team PDF"); $pdf->SetHeaderData('', '', PDF_HEADER_TITLE, PDF_HEADER_STRING); $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN)); $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); $pdf->SetDefaultMonospacedFont('helvetica'); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); $pdf->SetMargins(PDF_MARGIN_LEFT, '10', PDF_MARGIN_RIGHT); $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); $pdf->SetAutoPageBreak(TRUE, 10); $pdf->SetFont('helvetica', '', 11); $pdf->AddPage(); $content = ''; $content .= ' <h2 align="center">Team PDF</h2> <h4>Team Table</h4> <table border="1" cellspacing="0" cellpadding="3"> <tr> <th width="5%">ID</th> <th width="20%">Names</th> <th width="50%">Image</th> </tr> '; $content .= generateRow(); $content .= '</table>'; $pdf->writeHTML($content); $pdf->Output('team.pdf', 'I'); ?>
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Generation time: 1.5 |
proxy
|
phpinfo
|
Settings