Level 10
How to set utd-8 in dompdf
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I installed dompdf but it for Persian language not working.
ArtileController
public function pdf()
{
$articles = Article::all();
$pdf = PDF::loadView('articles', compact('articles'));
return $pdf->download('articles.pdf');
}
articles.blade.php
<!doctype html>
<html lang="fa" dir="rtl">
<head>
<!-- Required meta tags -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
<title>Test</title>
<style>
</style>
</head>
<body>
@foreach($articles as $article)
<h1>{{ $article->title }}</h1>
<p>{{ $article->body }}</p>
<hr>
@endforeach
</body>
</html>
I see this demo
Please or to participate in this conversation.