I'm using Laravel 5.5 with DOMPDF its work fine for English but not working for Unicode it's always output ????
symbol to me
Controller
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use PDF;
class PdfController extends Controller
{
public function export(){
$data['title']="Print Report";
$pdf = PDF::loadView('pdf.invoice', $data);
return $pdf->download('invoice.pdf');
}
}
Blade
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style>
@font-face {
font-family: khmer;
font-style: normal;
font-weight: 400;
src: url({{asset('fonts/khmer.ttf')}}) format('true-type');
}
</style>
</head>
<body>
កម្ពុជាក្រោម
</body>
</html>
Result ?????????
you just need to add font-family: DejaVu Sans; in your body or also you can set the font family to any specific div in which you are going to display the Unicode Characters.
For body:
body{font-family: DejaVu Sans;}
And for a specific div:
<div style="font-family: DejaVu Sans;"> --- </div>
Hope this would help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With