在laravel 4上为barryvdh / laravel-dompdf提供utf-8支持

时间:2014-11-06 07:51:22

标签: php laravel-4 dompdf

我正在使用来自here的dompdf包。 我能够将我的视图文件加载到pdf中。但是应该用中文的文字没有显示出来。我试过添加字体,但仍然没有解决问题。 我的视图文件示例

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style>
@font-face {
font-family: firefly;
src: {{ storage_path().'/fonts/fireflysung.ttf' }};
}
</style>
</head>
<body>

<h3>Summary Invoice Report</h3>

Date from {{ $from }} to {{ $to }}
<p>Date: {{ date('Y-m-d') }}</p>
<table border="1">
<thead>
    <tr>
        <th>INVOICE</th>
        <th>DATE</th>
        <th>COMPANY NAME</th>
        <th>TOTAL AMT</th>
        <th>OUTSTANDING</th>
        <th>CANCEL AMT</th>
    </tr>
</thead>

<tbody>
@foreach ($data as $row)
    <tr>
        <td> {{ $row->invoice_number }} </td>
        <td>{{ $row->created_at }} </td>
        <td>{{ $row->customer_name }} </td>
        <td>{{ $row->total_amount }} </td>
        <td>{{ $row->total_outstanding_amount }} </td>
        <td>{{ $row->cancel_amount }} </td>
    </tr>
@endforeach
<tr>
    <td colspan="3">Total</td>
    <td>{{ $total_invoice }}</td>
    <td>{{ $total_outstanding }}</td>
    <td>{{ $total_cancel }}</td>
</tr>
</tbody>
</table>
</body>
</html>

0 个答案:

没有答案