简体   繁体   English

mpdf无法在服务器上生成.pdf文件

[英]mpdf cannot generate .pdf file on the server

My php code is something like this : 我的PHP代码是这样的:

$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. 我下载了一个.pdf文件。 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. 我是使用mpdf的新手,对此我不太了解。 Any help, please? 有什么帮助吗?

Added as an answer per the OP's request: 根据OP的要求添加为答案:

Adding 添加

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

to the top of your file enables displaying all errors, which always gives useful debugging information. 文件顶部的启用将显示所有错误,该错误始终会提供有用的调试信息。

Do remember to remove this code in production environments though. 不过请记住在生产环境中删除此代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM