MPDF error: Some data has already been output to browser

Asked

Viewed 3,293 times

0

Hello,

I am having a very strange error using mPDF library to generate PDF.

The page fetches data from the database and displays on the page and mPDF in turn generates the pdf.

However, when not PDF the data is displayed, but if Gero pdf does not display anything only this msg error:

mPDF error: Some data has already been output to browser, can’t send PDF file

But if I do not ask you to generate the pdf from the database the pdf is displayed normally.

Remembering that the mpdf folder is with permission (I left with 777) to see was this, but not solved.

Code for pdf generation:

define('MPDP_PATH', 'MPDF54/');

include(MPDP_PATH.'mpdf.php');
$mpdf=new mPDF(); 
$mpdf->SetDisplayMode('fullpage');

$mpdf->WriteHTML($html);
$mpdf->Output();
  • I think it’s something similar => http://answall.com/q/4251/91

1 answer

2


Do it:

define('MPDP_PATH', 'MPDF54/');

include(MPDP_PATH.'mpdf.php');

ob_clean();//Limpa o buffer de saída

$mpdf=new mPDF(); 
$mpdf->SetDisplayMode('fullpage');

$mpdf->WriteHTML($html);
$mpdf->Output();

Browser other questions tagged

You are not signed in. Login or sign up in order to post.