mpdf cannot generate .pdf file on the server

时间:2015-04-24 21:33:45

标签: php pdf server mpdf

My php code is something like this :

$htmlOut = 'Some html code';

include("libraries/MPDF60/mpdf60/mpdf.php");

$mpdf=new mPDF('c','A4','','' , 0 , 0 , 0 , 0 , 0 , 0); 

$mpdf->SetDisplayMode('fullpage');

$mpdf->list_indent_first_level = 0;

$mpdf->WriteHTML($htmlOut);

$mpdf->Output("filename.pdf",'I');

I am using this exact same code on my localhost and everything is working perfect. I get a .pdf file downloaded. But on trying the same code on the server, this does not work. There is no error shown. Just a blank white page. I am new to using mpdf, and I do not know much about this. Any help, please?

1 个答案:

答案 0 :(得分:1)

根据OP的要求添加了答案:

添加

error_reporting(E_ALL); 
ini_set('display_errors', 1);

到文件顶部可以显示所有错误,这些错误始终提供有用的调试信息。

请记住在生产环境中删除此代码。