laravel-dompdf icon indicating copy to clipboard operation
laravel-dompdf copied to clipboard

How to Use UTF-8 | Add arabic language

Open galtechstaffs opened this issue 3 years ago • 14 comments

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();

galtechstaffs avatar Nov 09 '22 11:11 galtechstaffs

This is only a wrapper, dompdf package it not here

erikn69 avatar Nov 10 '22 15:11 erikn69

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

Abdullah-Iftikhar avatar Nov 11 '22 12:11 Abdullah-Iftikhar

try to add this to the part

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

taiwanleaftea avatar Dec 08 '22 11:12 taiwanleaftea

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.

Abdullah-Iftikhar avatar Dec 08 '22 12:12 Abdullah-Iftikhar

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

taiwanleaftea avatar Dec 08 '22 13:12 taiwanleaftea

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.

stale[bot] avatar Jun 18 '23 08:06 stale[bot]

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

oualidoukassou avatar Feb 02 '24 21:02 oualidoukassou

Anything for ar !

ahmadalnaib avatar Mar 12 '24 15:03 ahmadalnaib

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,

adnane-ka avatar Jun 29 '24 19:06 adnane-ka

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?

Magnatox avatar Jul 27 '24 15:07 Magnatox

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.

oualidoukassou avatar Jul 29 '24 11:07 oualidoukassou

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?

Magnatox avatar Jul 30 '24 20:07 Magnatox

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.

adnane-ka avatar Jul 31 '24 11:07 adnane-ka

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

Magnatox avatar Jul 31 '24 21:07 Magnatox