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

imranafzal02's avatar

Laravel DomPDF issue with Arabic Content

I am facing an issue in generating the PDF file using Laravel domPDF. Below is the code explain that I am using.

In side my controller I an calling a view file that is supposed to be converted into PDF.

	$pdf = Pdf::loadView('Invoice.center-point', compact('saleDetails', 'centerPointSale'));
	return $pdf->stream();

Here is my blade file

<!DOCTYPE html>
<html>
 <head>
    <meta charset="UTF-8">
	<style>
    @font-face {
        src: url('/public/Theme/css/fonts/NotoNaskhArabic-VariableFont_wght.ttf');
        font-family: 'Noto Naskh Arabic';
        font-weight: normal;
        font-style: normal;
    }

    td {
        font-size: 12px !important;
    }
    p {
        margin: 2px 0px !important;
        font-size: 13px;
    }
    .content table tbody tr:nth-child(odd) {
        background: #CCC
    }
    .arabic {
        font-family: 'Noto Naskh Arabic' !important;
    }
</style>
<body>
    <div dir="rtl">
        <h1 class="arabic" style="font-family: 'Noto Naskh Arabic' !important; font-size: 18px !important; margin: 0px !important; margin-bottom: 5px !important; text-align: center;">
		{{ $general_setting->site_title_ar }}
      </h1>
    </div>
   </body>
</html>

when I run this code, it displays??? instead of actual Arabic content. I am using Laravel 8.0 and barryvdh/laravel-dompdf 2.0

0 likes
0 replies

Please or to participate in this conversation.