Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

generate dynamic rows in pdf using html2pdf

Tags:

php

pdf

html2pdf

I am using html2pdf to generate a pdf.i need to generate some rows dynamically. My code is..

         <?php
        require_once("html2pdf.class.php");
        $content = '<html><body><table border="0"  >
        <tr><td align="center" > <h4><b> CHAMPIONSHIP
        2015-16</b> </h4></td> </tr>
        <tr><td align="center"><h4><b>
        </b></h4></td></tr>
        <tr><td align="center"><h4><b>DETAILED ENTRY</b>
        </h4> </td></tr>
        <tr><td><h4><b>Name of Manager :</tr>

        </table>
        $html2pdf = new HTML2PDF
        ('L','A4','de',true,'UTF-8',array(10, 10, 10, 10));
        $html2pdf->WriteHTML($content);
        $html2pdf->Output($filename.'.pdf');

How i can add php inside this content.If it doesn't work anyway pls suggest something else to generate the pdf..Thank you

like image 896
Nola3191 Avatar asked Nov 28 '25 22:11

Nola3191


1 Answers

Can't you do this like basic PHP ?

$your_var = 'what you want';

$content = '<html><body><table border="0">';
$content .= '<html code...>'.$your_var.'</...html code>';
$content .= '</table></body><html>';
like image 61
Alex197 Avatar answered Nov 30 '25 11:11

Alex197



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!