首页 > 解决方案 > 使用 Dejavu 字体时,DOMPDF 输出到服务器不显示文本

问题描述

当您使用 DOMPDF 在服务器上保存 PDF 并且想要在服务器上查看/打开 PDF 时,你们中的某个人遇到过问题,之后看不到字符而是块?

我有以下输出。

//Download PDF
$dompdf->stream("Invoice: ".$row['number'].".pdf", array("Attachment" 
=> true));
//save the pdf file on the server
file_put_contents('uploads/'.$row['number'].'.pdf', $dompdf- 
>output()); 

这用于样式:

*{ font-family: DejaVu Sans;}

@font-face {
      font-family: "DejaVuSans";
      font-style: normal;
      font-weight: normal;
      src: url('fonts/DejaVuSans.ttf') format('truetype');
    }

标签: phphtmlcssfontsdompdf

解决方案


推荐阅读