php - MPDF 57, not working in Windows -
i have used particular code download pdf using "mpdf 57":
ob_start(); ob_clean(); // cleaning buffer before output() $html = ' <div style="font-weight:bold;font-size:40px;color:#264664";>title</div> <img src='.$imgsrc.' name="image1"> '; $mpdf=new mpdf('c','a4'); $mpdf->writehtml($html); $mpdf->output('chart_'.time().'.pdf','d'); exit;
i got code working fine ubuntu. failed in windows. when downloaded file opened reader, throws error message file corrupted. has gone wrong code? cannot find why piece of code works browsers in ubuntu os , not browsers in windows os?
my guess it's parse error ubuntu can handle windows cannot. have 2 tiny syntax errors. first, semicolon out of place:
<div style="font-weight:bold;font-size:40px;color:#264664";>title</div>
should be:
<div style="font-weight:bold;font-size:40px;color:#264664;">title</div> ---------^
and second, missing quotes around src attribute:
<img src='.$imgsrc.' name="image1" />
should be:
<img src="'.$imgsrc.'" name="image1">
Comments
Post a Comment