barryvdh / laravel-dompdf

A DOMPDF Wrapper for Laravel
MIT License
6.73k stars 969 forks source link

How to Use UTF-8 | Add arabic language #931

Open galtechstaffs opened 1 year ago

galtechstaffs commented 1 year ago

I get the PDF, but the Arabic character are like "??????" question mark icon composer.js "barryvdh/laravel-dompdf": "^2.0",

app.js 'providers' => [ Barryvdh\DomPDF\ServiceProvider::class, ], 'aliases' => [ 'PDF' => Barryvdh\DomPDF\Facade::class, ]

controller $pdf = PDF::loadView('admin.invoice.invoicepdf', ['invoices' => $invoices,]); return $pdf->stream();

erikn69 commented 1 year ago

This is only a wrapper, dompdf package it not here

Abdullah-Iftikhar commented 1 year ago

@galtechstaffs I am facing the same issue with the Chinese version. Is there anyone have a solution to it? @barryvdh

taiwanleaftea commented 1 year ago

try to add this to the part

body { font-family: DejaVu Sans, serif; }

Abdullah-Iftikhar commented 1 year ago

This can only work if you have a font file in your storage and then include it in your PDF blade file. I got a solution for it.

image

everything is clear in the image.

taiwanleaftea commented 1 year ago

DejaVu fonts are already installed. I don't know, if it has Arabic. Or you can include any font via font-face.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any issues with PDF rendering itself that are not directly related to this package, should be reported on https://github.com/dompdf/dompdf instead. When having doubts, please try to reproduce the issue with just dompdf. If you believe this is an actual issue with the latest version of laravel-dompdf, please reply to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.

oualidoukassou commented 9 months ago

I am facing the same issue with arabic language. i will be thankful if any one has a solution.

ahmadalnaib commented 7 months ago

Anything for ar !

adnane-ka commented 4 months ago

For those who still facing a problem with rendering arabic charachters. turning the auto_language_detection option in the config file pdf.php to true fixed my problem.

'auto_language_detection'  => true,
Magnatox commented 3 months ago

For those who still facing a problem with rendering arabic charachters. turning the auto_language_detection option in the config file pdf.php to true fixed my problem.

'auto_language_detection'  => true,

Where exactly is this pdf.php file?

oualidoukassou commented 3 months ago

For those who still facing a problem with rendering arabic charachters. turning the auto_language_detection option in the config file pdf.php to true fixed my problem.

'auto_language_detection'  => true,

Where exactly is this pdf.php file?

You can find it in the config folder.

Magnatox commented 3 months ago

For those who still facing a problem with rendering arabic charachters. turning the auto_language_detection option in the config file pdf.php to true fixed my problem.

'auto_language_detection'  => true,

Where exactly is this pdf.php file?

You can find it in the config folder.

Hello @oualidoukassou ! I'm not sure which pdf.php file or config folder you're referring to. Are we using the same version? I'm using the latest version of laravel-dompdf (v2.2.0) I've found this solution to be working with short texts, but it breaks when passing longer texts to it. Expected output:

يتم اختيار فريقنا بدقة بناءً على معايير تأهيل صارمة ويتعرض لرقابة جودة مستمرة من خلال لجنتنا.

Actual output: image Has anyone found any solution to this yet?

adnane-ka commented 3 months ago

For those who still facing a problem with rendering arabic charachters. turning the auto_language_detection option in the config file pdf.php to true fixed my problem.

'auto_language_detection'  => true,

Where exactly is this pdf.php file?

You can find it in the config folder.

Hello @oualidoukassou ! I'm not sure which pdf.php file or config folder you're referring to. Are we using the same version? I'm using the latest version of laravel-dompdf (v2.2.0) I've found this solution to be working with short texts, but it breaks when passing longer texts to it. Expected output:

يتم اختيار فريقنا بدقة بناءً على معايير تأهيل صارمة ويتعرض لرقابة جودة مستمرة من خلال لجنتنا. Actual output: image Has anyone found any solution to this yet?

Sorry for the typo, by mentioning pdf.php i was referring to the configuration file published by another package: mccarlosen/laravel-mpdf Which i found more suitable to arabic. I think it's what you're looking for.

Magnatox commented 3 months ago

Hello @adnane-ka ! Thank you for your quick response! How was the transition from dompdf to mPDF? Was it smooth?