1
votes

I am trying to print my content to PDF using Mpdf tool . The code is working in localhost , But when i tired same code in server its not working giving some eroor "mPDF error: Some data has already been output to browser, can't send PDF file".

My code is :

<?php




    $address = "banglore rt nagar";

    $template_data  = " hello this is test ##ADDRESS## adress";

    $template_data = str_replace('##ADDRESS##', $address , $template_data);


   ob_end_clean(); 

   include 'MPDF57/mpdf.php';



       $mpdf=error_reporting(E_STRICT);
       $mpdf=new mPDF('win-1252','A4','','',15,10,16,10,10,10);
       $mpdf->Bookmark('Start of the document');
       $mpdf->SetDisplayMode('fullpage');
       $mpdf->WriteHTML($template_data);
       $mpdf->Output();

       exit();


       ?>

i have tried lot of solutions . but nothing works good . any help ?

1

1 Answers

1
votes

Use ob_start(); after the <?php tags . hope it will helps you .

more ohttp://php.net/manual/en/function.ob-start.php