hello guys, i have create a class to make easy use on framework:

your HTML(can use ajax response to writte this):
<object data="data:application/pdf;base64,<?=@$doc?>" type="application/pdf" width="100%" height="800px"> <p>It appears you don't have a PDF plugin for this browser. No biggie... you can <a href="resume.pdf">click here to download the PDF file.</a></p> </object>
your personal class:
<?php class Class_Personal{ # ============================================================================================ public function __construct(){ $this -> PDFMANAGER = new Class_PdfManager(); } public function __destruct(){ $this -> PDFMANAGER = new Class_PdfManager(); } function example(){ #Array Init for documente $P = $this -> PDFMANAGER -> InitPDFSistem(); #you can personalice the array #Example: $P['CONT']=' <table cellspacing="0" cellpadding="0" border="1"> <col width="80" span="4"> <tr> <td colspan="4" width="320">Documento de prueba</td> </tr> <tr> <td>cuadro 1</td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>cuadro 2</td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>cuadro 3</td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td colspan="3">pie de pagina</td> </tr> </table>'; $P = $this -> PDFMANAGER -> GenPDF2List($P); $doc = base64_encode($P['DOC']); return $doc; } }

the Class Manager of PDF(call to html2pdf):
<?php <?php class Class_PdfManager{ function __construct(){ } function __destruct(){ } function InitPDFSistem(){ $P=[]; $P['CONT'] = ''; #Contenido $P['VIEW'] = 'P'; #Forma de Vista P=Portrait, L=Landscape $P['PSIZE'] = 'LETTER'; #Tamaño de la pagina $P['LANG'] = 'en'; #Lenguaje $P['TITTLE'] = 'Documento sin Titulo'; #Titulo $P['AUTOR'] = 'Avipac Inc. LTD'; #Autor $P['out'] = true; #output param return $P; } function GenPDF2List($P){ try{ $html2pdf = new HTML2PDF($P['VIEW'], $P['PSIZE'], $P['LANG']); $html2pdf->pdf->SetAuthor($P['AUTOR']); $html2pdf->pdf->SetTitle($P['TITTLE']); $html2pdf->writeHTML($P['CONT']); $P['DOC'] = $html2pdf->Output('', $P['out']); return $P; exit; }catch(HTML2PDF_exception $e) { echo $e; exit; } } } ?>
avatar