Sajib Acharya
Sajib Acharya

Reputation: 1733

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?

Upvotes: 1

Views: 4670

Answers (1)

user1544337
user1544337

Reputation:

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.

Upvotes: 1

Related Questions