简体   繁体   中英

mpdf cannot generate .pdf file on the server

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?

Added as an answer per the OP's request:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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