Can't Use Thai Language in DOMPDF

时间:2017-06-19 13:54:09

标签: laravel dompdf

I can't use thai language in DOMPDF

https://github.com/barryvdh/laravel-dompdf

I have use this

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <style>
        @font-face {
            font-family: 'THSarabunNew';
            font-style: normal;
            font-weight: normal;
            src: url("file://{{ asset('fonts/THSarabunNew.ttf') }}") format('truetype');
        }
        body {
            font-family: "THSarabunNew";
        }
    </style>
<body>
    <table>
      <tr>
        <th>name</th>
        <th>email</th>
      </tr>
      @foreach ($customer as $c)
        <tr>
          <td>สวัสดี {{$c->name}}</td>
          <td>{{$c->email}}</td>
        </tr>
      @endforeach

    </table>
</body>

The result in thai language "สวัสดี" => "?????".Please Help me.

1 个答案:

答案 0 :(得分:0)

你的css中有错误。

而不是:

src: url("file://{{ asset('fonts/THSarabunNew.ttf') }}");

你应该:

src: url({{ asset('fonts/THSarabunNew.ttf') }}");

还要确保公用文件夹中有fonts文件夹。