Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

shahr's avatar
Level 10

How to set utd-8 in dompdf

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

pdf

0 likes
6 replies
shahr's avatar
Level 10

How to set utd-8 in dompdf

automica's avatar

@oxbir you don't need to ask again. your thread is still visible, its just that noone has answered you yet.

Please or to participate in this conversation.