barryvdh / laravel-dompdf

A DOMPDF Wrapper for Laravel
MIT License
6.74k stars 973 forks source link

error in persian and arabic language #594

Closed erfanhemmati closed 4 years ago

erfanhemmati commented 5 years ago

hi friends this package dose not support persian or arabic language for why ?!

mRamadan0101 commented 5 years ago

im working with laravel 5.7 & barryvdh/laravel-dompdf 0.8.4 fixed arabic letters as below:-

1- download the ar-php library for khaled.alshamaa from the following link http://www.ar-php.org/ (its free arabic Library with LGPL license)

2 - extract and upload I18N folder inside dompdf folder

3- open Glyphs.php file in this path

vendor\dompdf\I18N\Arabic

search

      public function utf8Glyphs($str, $max_chars = 50

replace to

     public function utf8Glyphs($str, $max_chars = 150

4-in text_renderer.cls.php file vendor/dompdf/dompdf/src/Render/Text.php

before class name class Text extends AbstractRenderer add this

include DOMPDF_DIR . "/I18N/Arabic/Glyphs.php"; use I18N_Arabic_Glyphs;

before this line

$this->_canvas->text($x, $y, $text

add this code

if ( ! class_exists( 'I18N_Arabic' ) ){ $Arabic = new I18N_Arabic_Glyphs('Glyphs'); $text = $Arabic->utf8Glyphs($text);

}

in ur pdf file add this style

body{
  font-family: DejaVu Sans, sans-serif;
}
Ammar09 commented 5 years ago

include(C:\laragon\www\tamaiuz\vendor\dompdf\dompdf/I18N/Arabic/Glyphs.php): failed to open stream: No such file or directory

this error appeared after i follow the instructions

hannanstd commented 4 years ago

use below package: https://github.com/mccarlosen/laravel-mpdf

i tested and works with persian well.

stale[bot] commented 4 years 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. Thank you for your contributions. Most issues are actually related to DompDF (eg rendering the PDF itself), so please raise an issue there: https://github.com/dompdf/dompdf If you believe this is still an actual issue with this library, please reply to this issue.

heshanmax commented 2 years ago

use below package: https://github.com/mccarlosen/laravel-mpdf

i tested and works with persian well.

@hannanstd when I use this all the pages come blank

mounir4019 commented 1 year ago

juste use easy and perfect solution, without domPdf

mounir4019 commented 1 year ago

juste use easy and perfect solution, without domPdf