1、使用的库为phpoffice下的phpword/phpexcel/phpcommon

2、phpword默认支持的pdf库有tcpdf/dompdf/mppdf

3、使用mpdf解决关于中文字体乱码,  

关于php对pdf于word的支持

修改值

  • $this->autoScriptToLang = true;
  • $this->autoLangToFont = true;
  • linux下需要将src同级的tmp目录设置可以写
  • 若是上面的解决方案不行。就用一下方案
  • $mpdf=new mPDF('UTF-8','A4','','',11,11,11,11);
  • $mpdf->useAdobeCJK = true;
  • $mpdf->SetAutoFont(AUTOFONT_ALL);
  • $mpdf->SetDisplayMode('fullpage');
  • $mpdf->WriteHTML($content);
  • $mpdf->Output();

4、调用前设置pdf目录

Settings::setPdfRendererPath('/xxxx/mpdf/mpdf');
Settings::setPdfRendererName("MPDF");

相关文章:

  • 2021-11-21
  • 2021-11-25
  • 2022-12-23
  • 2021-07-20
  • 2021-05-15
  • 2022-12-23
  • 2022-12-23
  • 2021-05-18
猜你喜欢
  • 2021-12-26
  • 2021-10-25
  • 2021-07-23
  • 2022-02-09
  • 2021-11-30
  • 2021-10-17
相关资源
相似解决方案