how to set mpdf HTML contains invalid UTF-8 character(s)
PDF导出中文 洗衣液厂家(品牌;海依恋+纤维大师�<br>��
Invalid input characters. Did you set $mpdf->in_charset properly?
解决方案
#Try this
$html = mb_convert_encoding($html, 'UTF-8', 'UTF-8');
#before calling: "$mpdf->WriteHTML($html);"
#It's seems senseless, but it works for me.
demo
$html = __DIR__.DIRECTORY_SEPARATOR.'pdf.html';
$html = mb_convert_encoding($html, 'UTF-8', 'UTF-8');
$mPdf = new Mpdf(defaultPdfConfig());
$mPdf->WriteHTML($html);
$fileDir = './tinywan.pdf';
$mPdf->Output($fileDir, Destination::FILE);
洗衣液厂家(品牌;海依恋+纤维大师�<br>��