2016-11-21 328 views
0

你好,我有一个问题,Font not not in DOMPDF

我想添加一个条形码字体的标签,我生成的PDF标签。

当我生成PDF中的标签它不工作,但在我看来它工作正常。

我使用DOMPDF为laravel。

查看: enter image description here

PDF: enter image description here

我包括我的字体像这样:

<style> 
    @font-face { 
     font-family: 'barcode_fontregular'; 
     src: url('{{url('/css/barcode/BarcodeFont.ttf')}}') format('woff2'), 
      url('{{url('/css/barcode/BarcodeFont.ttf')}}') format('woff'); 
      url('{{url('/css/barcode/BarcodeFont.ttf')}}') format('truetype'); 
     font-weight: normal; 
     font-style: normal; 

    } 
</style> 

我到底做错了什么? 任何帮助表示赞赏。

谢谢!

+0

你把你的“css”文件夹放在哪里? – Ronald

+0

在laravel应用程序的根文件夹@Ronald – Rubberduck1337106092

+0

不在公用文件夹中?如果你把它放在公共文件夹中,我建议使用这个{{URL :: asset('/ css/barcode/BarcodeFont.ttf')}} – Ronald

回答

1

找到了解决办法:

首先是在我的风格一个错字:

url('{{url('/css/barcode/BarcodeFont.ttf')}}') format('woff'); 
url('{{url('/css/barcode/BarcodeFont.ttf')}}') format('truetype'); 

的;在第一行必须是逗号。

然后,它给了我一个不同的错误,指向未找到的/ storage/fonts。

我创建了目录并将BarcodeFont.ttf放置在那里,它工作。

非常感谢每一个试图帮助我的人!