Gerar Relatório em PDF com MPDF
Estou com uma dúvida em gerar relatório utilizando a classe mpdf , realizo uma consulta com filtro no BD e preciso gerar um pdf com os dados retornados dessa consulta específica.
<?php
include 'conexao.php';
$todos = mysql_query($_SESSION['busca']);
$html = '
<table cellspacing="0" width="100%" border="1">
<thead>
<tr>
<td width="17%" class="tc">Data Pagamento</td>
<td width="13%" class="tc">Descrição</td>
<td width="9%" class="tc">Tipo Despesa</td>
<td width="15%" class="tc">Data Vencimento</td>
<td width="15%" class="tc">Valor não Fiscal</td>
<td width="13%" class="tc">Valor Fiscal</td>
<td width="13%" class="tc">Valor Total</td>
<td width="5%" class="tc">Status</td>
</tr>
</thead>
<tbody>';
while ($dados=mysql_fetch_array($todos)) {
$html .= '<tr>';
$html .= '<td>'.$dados[pagamento].'</td>';
$html .= '<td>'.$dados[descricao].'</td>';
$html .= '<td>'.$dados[tipo_despesa].'</td>';
$html .= '<td>'.$dados[vencimento].'</td>';
$html .= '<td>'.$dados[nao_fiscal].'</td>';
$html .= '<td>'.$dados[fiscal].'</td>';
$html .= '<td>'.$dados[total].'</td>';
$html .= '<td>'.$dados[status].'</td>';
$html .= '</tr>';
}
$html .= '</tbody>
</table>';
include("../mpdf.php");
$mpdf=new mPDF('c','A4','','',10,10,27,25,16,13);
$mpdf->SetDisplayMode('fullpage');
$mpdf->list_indent_first_level = 0;
$stylesheet = file_get_contents('mpdfstyletables.css');
$mpdf->WriteHTML($stylesheet,1);
$mpdf->WriteHTML($html,2);
$mpdf->Output('mpdf.pdf','I');
exit;
?>
Ele não consegue gerar o relatório e retorna o seguinte erro:
Warning: Cannot modify header information - headers already sent by ...
mPDF error: Some data has already been output to browser, can't send PDF file
Discussão (2)
Carregando comentários...