Javascript with PHP to generate a PDF

0

I'm having a PivotTable in JavaScript . I need to send to PHP all the items that have been added to it and generate a PDF with class mPDF .

Someone could help.

HTML / Javascript code: link

PHP Code:

<?php
$item = utf8_encode($_POST['item']);<br>
$descricao = utf8_encode($_POST['descricao']);<br>
$unidade = utf8_encode($_POST['unidade']);<br>
$pedido = utf8_encode($_POST['pedido']);<br>

//PEGA O ARQUIVO MODELO<br>
$pdf = file_get_contents("modelo.html");<br>

//SUBSTITUI COM OS DADOS FORNECIDOS<br>
$pdf = str_replace("#item","$item",$pdf);<br>
$pdf = str_replace("#descricao","$descricao",$pdf);<br>
$pdf = str_replace("#unidade","$unidade",$pdf);<br>
$pdf = str_replace("#pedido","$pedido",$pdf);<br>

//SOLICITA A CLASS MPDF<br>
require_once("mpdf/mpdf.php");<br>

//INSTANCIA A CLASS MPDF<br>
$mpdf = new mPDF( );<br>

//ESCREVE O PDF<br>
$mpdf->WriteHTML($pdf);<br>
ob_clean();<br>

//SAIDA DO PDF NO NAVEGADOR<br>
$mpdf->Output();<br>
?>

I'm using Bootstrap 3.3.7

    
asked by anonymous 30.03.2018 / 00:48

0 answers