Jump to content


New Members
  • Posts

  • Joined

  • Last visited

Aswin's Achievements


Newbie (1/5)



  1. but a small problem while am clicking all products it was downloading even am changed into D
  2. Thank you for your great support. i will try the best. and once again thank u so much
  3. <?php function fetch_data(){ $conn=mysqli_connect("localhost","root","","pdf"); $output=''; $sql="SELECT * FROM tables"; $result=mysqli_query($conn,$sql); $sno=0; while($row=mysqli_fetch_array($result)){ $output.= '<tr> <td>' .$row["product_id"].'</td> <td>' .$row["product_name"].'</td> </tr>'; } return $output; } // if(isset($_POST["createpdf"])){ require_once('tcpdf_min/tcpdf.php'); $obj_pdf= new TCPDF('P',PDF_UNIT,PDF_PAGE_FORMAT,true, 'UTF-8',false); $obj_pdf->SetCreator(PDF_CREATOR); $obj_pdf-> SetTitle("Product PDF"); $obj_pdf->SetHeaderData('', '',PDF_HEADER_TITLE,PDF_HEADER_STRING); $obj_pdf->SetHeaderFont(Array(PDF_FONT_NAME_MAIN, '',PDF_FONT_SIZE_MAIN)); $obj_pdf->SetHeaderFont(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); $obj_pdf->SetAutoPageBreak(TRUE,10); $obj_pdf -> SetFont('helvetica', '',12); $obj_pdf->AddPage(); $content=''; $content .='<h4 align="center">Generate Pdf</h4><br> <table border="1" cellspacing="0" cellpadding="3"> <tr> <th>Id</th> <th>Name</th> </tr>'; $content .= fetch_data(); $content .= '</table>'; $obj_pdf->writeHTML($content); $obj_pdf->Output('Sample Pdf','I'); //} ?> <!DOCTYPE html> <!DOCTYPE html> <html> <head> <title>Pdf Generation</title> <link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"> </head> <body> <br> <!-- <h4 align="center">Pdf Output</h4> --> <table> <tr> <th>Id</th> <th>Name</th> </tr> <?php echo fetch_data(); ?> </table> <form method="post"> <input type="submit" name="createpdf" value="Generate Pdf"> </form> </body> </html> This is the code which am using here i have to create pdf for each product will u help me
  4. Guys will you help me by Creating multiple pdf using single command using tcpdf in php it will most helpful for me
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.