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

shahr's avatar
Level 10

Dompdf id givving ???

I installed this package.

pdf

I installed dompdf in my project. I want to export auth()->user() in laravel and I have a problem like this image.

pdf

Controller.php

use Barryvdh\DomPDF\Facade as PDF;

public function PDF()
{
    $pdf = PDF::loadView('load-pdf');
    $pdf->set_option('font-family', 'Tahoma');
    return $pdf->download('user.pdf');
}

load-pdf.blade.php

<!doctype html>
<html lang="fa" dir="rtl">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link rel="stylesheet" href="{{ asset('css/bootstrap.min.css') }}">
    <link rel="stylesheet" href="{{ asset('css/bootstrap.min-rtl.css') }}">
    <style>
        * {
            font-family: Tahoma;
        }
    </style>
</head>
<body>
<div class="row">
    <div class="col-md-2">
        <img src="{{ asset('images/users/'.auth()->user()->image) }}" class="rounded-circle w-25">
    </div>
    <div class="col-md-10">
        <div class="row">
            <div class="col-md-4">
                <div>نام:</div>
                <div>{{ auth()->user()->first_name }}</div>
            </div>
            <div class="col-md-4">
                <div>نام خانوادگی:</div>
                <div>{{ auth()->user()->last_name }}</div>
            </div>
            <div class="col-md-4">
                <div>عنوان شغلی رزومه:</div>
                <div>{{ auth()->user()->job_title }}</div>
            </div>
        </div>
    </div>
</div>
</body>
</html>
0 likes
6 replies
ahmeddabak's avatar

Please explain better what you want to do, which errors you are facing. the title has no meaning, and i do not see where is the problem in the image

shahr's avatar
Level 10

@ahmeddabak

Error for Farsi language but when i selected that is not showing correct words.

ahmeddabak's avatar

Like i told you yesterday install this package khaledsabbah / laravel-dompdf instead of barryvdh/laravel-dompdf.

this library has support for right to left arabic letters which are used in Farsi and it exports all pdfs in utf-8 unicode

shahr's avatar
Level 10

@ahmeddabak

Should I install composer require khaledsabbah/laravel-dompdf in this way?

ahmeddabak's avatar

Read the docs of the package, i gave you the link

Please or to participate in this conversation.