无法打印pdf(MPDF)

时间:2015-11-14 07:01:27

标签: php pdf mpdf

我正在尝试使用Mpdf工具将我的内容打印到PDF。该代码在localhost中工作,但是当我厌倦了服务器中的相同代码时,它无法正常工作“mPDF错误:某些数据已经输出到浏览器,无法发送PDF文件”。

我的代码是:

<?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();


       ?>

我尝试了很多解决方案。但没有什么效果好。有什么帮助吗?

1 个答案:

答案 0 :(得分:1)

使用ob_start();在<?php标记之后。希望它会帮助你。

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

相关问题