By using laravel-pdf, I am trying to make print page which includes Korean. Html view page works fine but once converted it to pdf and stream, Only Korean part shows like ????
- controller
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
use PDF;
class TestController extends Controller
{
public function pdf(){
$pdf = PDF::loadView('pdf_view2');
return $pdf->stream();
}
public function html(){
return view('pdf_view2');
}
}
- blade
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style>
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@100;300;500;700;900&family=Open+Sans&family=Roboto&family=Single+Day&display=swap');
* {
font-family: 'Noto Sans KR', sans-serif;
font-family: 'Open Sans', sans-serif;
font-family: 'Roboto', sans-serif;
font-family: 'Single Day', cursive;
}
</style>
</head>
<body>
<div>
<h2>Hello, world~!</h2>
<h1>안녕 세상아~~!</h1>
</div>
</body>
</html>
*output [html vs pdf] [1]: https://i.stack.imgur.com/aXJny.png