Delete your following line:
echo $numPresup;
Question
I am using mPDF to create a PDF on the fly from a PHP generated site.
My code looks like this:
ini_set('memory_limit', '-1');
include('../mpdf/mpdf.php');
$numPresup = "presupuesto_".$_GET['numPresup'].".html";
echo $numPresup;
$mpdf=new mPDF();
$stylesheet = file_get_contents('design.css');
$mpdf->WriteHTML($stylesheet,1);
$mpdf->WriteHTML(file_get_contents($numPresup));
$mpdf->Output();
unlink($numPresup);
exit;
But I keep getting this error:
Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhost/artidental.com/home/html/Presupuestos/pdfExport.php:5) in /var/www/vhost/artidental.com/home/html/mpdf/mpdf.php on line 7049
Warning: Cannot modify header information - headers already sent by (output started at /var/www/vhost/artidental.com/home/html/Presupuestos/pdfExport.php:5) in /var/www/vhost/artidental.com/home/html/mpdf/mpdf.php on line 1727
mPDF error: Some data has already been output to browser, can't send PDF file
Any clue of what the issue could be? The PDF files work fine since I tested the PDF with a "Hello World" and it works.
Thanks
Solution
Delete your following line:
echo $numPresup;
OTHER TIPS
Convert file to UTF without BOM ;-)