0

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.

patipat chewprecha
  • 255
  • 2
  • 6
  • 19

1 Answers1

1

You have mistake in your css.

Instead of:

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

You should have:

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

Also make sure that you have fonts folder in your public folder.

Martin
  • 1,259
  • 3
  • 17
  • 36
  • 1
    If it works you should approve my answer as the solution. – Martin Jun 20 '17 at 06:34
  • If you still can't see your language the problem is not located in laravel. Probably you have something wrong with file encoding... – Martin Jun 20 '17 at 10:10