Je travaille sur codeigniter. J'envoie des données d'une vue à un fichier qui prend les données et quand je lui fais écho, il montre directement sur la fenêtre modale mais dès que j'écris $mpdf->Output();
les données n'apparaissent pas et un écran apparaît comme:
Les données qui viennent en écho HTML directement sur la fenêtre modale, mais ne montre pas en PDF
Mon html envoyé est:
$html='';
$html .='
<table width="100%" class="pat-demo" id="pqrs_csv_list">
<thead>
<tr>
<th class="cols">Measure ID</th>
<th class="cols">Measure Name</th>
<th class="cols">Met</th>
<th class="cols">Not eligible</th>
<th class="cols">Not met</th>
<th class="cols">Exclusion</th>
</tr>
</thead>
<tbody>';
foreach ($arr as $aRow)
{
if($counter==2) { $bgcolor =""; $counter=1;} else { $bgcolor = "#FFF9F9"; $counter++; }
$html .='<tr bgcolor="'.$bgcolor.'">
<td class="cols" width="8%">'.$aRow['measureId'].'</td>
<td class="cols" width="55%%">'.$aRow['measureName'].'</td>
<td class="cols" width="8%">'.$this->percentage($aRow[1], $total_visits)."%".'</td>
<td class="cols" width="8%">'.$this->percentage($aRow[2], $total_visits)."%".'</td>
<td class="cols" width="8%">'.$this->percentage($aRow[3], $total_visits)."%".'</td>
<td class="cols" width="8%">'.$this->percentage($aRow[4], $total_visits)."%".'</td>
</tr>';
}
$html .='</tbody>
</table>';
ensuite le fichier qui prend ce HTML et où je tente de l'afficher dans la visionneuse PDF a le code:
$mpdf = new mPDF('utf-8', 'A4-L', 0, '', 10, 10, 32, 25, 5, 2,2,'P');
$mpdf->SetHTMLHeader('<div style="text-align: center; font-weight: bold;">'.$header.'</div>');
$mpdf->SetHTMLFooter($footer);
$mpdf->defaultheaderfontsize=10;
$mpdf->defaultheaderfontstyle='B';
$mpdf->defaultheaderline=0;
$mpdf->defaultfooterfontsize=10;
$mpdf->defaultfooterfontstyle='BI';
$mpdf->defaultfooterline=0;
header('Content-type: application/pdf');
$stylesheet = file_get_contents('admin_includes/css/print_pdf.css');
$mpdf->WriteHTML($stylesheet,1);
//echo $html;/// here it echos right but not goes to pdf
$mpdf->WriteHTML($html);
$mpdf->Output();
ne fonctionnait pas. La question est toujours la même –