在laravel DomPdf创建PDF期间更改希伯来文字符的方向

在laravel DomPdf创建PDF期间更改希伯来文字符的方向,laravel,pdf,laravel-5.4,dompdf,hebrew,Laravel,Pdf,Laravel 5.4,Dompdf,Hebrew,我有一个严重的问题 我想在PDF创建后以RTL格式显示希伯来语单词,但没有显示。它总是显示LTR 我有一些英语和希伯来语的单词组合 我在谷歌上做了一些搜索,但运气不好 我正在使用 我已经检查了我的dompdf核心文件dompdf\u UNICODE\u ENABLED,它的值是“dompdf\u UNICODE\u ENABLED”=>true,仍然无法获得解决方案 这是我的刀锉 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http

我有一个严重的问题

我想在PDF创建后以RTL格式显示希伯来语单词,但没有显示。它总是显示LTR

我有一些英语和希伯来语的单词组合

我在谷歌上做了一些搜索,但运气不好

我正在使用

我已经检查了我的dompdf核心文件
dompdf\u UNICODE\u ENABLED
,它的值是
“dompdf\u UNICODE\u ENABLED”=>true,
仍然无法获得解决方案

这是我的刀锉

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <html xmlns="http://www.w3.org/1999/xhtml" dir="rtl">

    </head>
    <body>

    <table class="lead" cellspacing="0" width="100%" style="font-size: 12px; font-family: 'firefly, DejaVu Sans, sans-serif'; ">
         <thead>
            <tr>
               <th width="10%" style="font-weight: bold;">Date</th>
               <th width="15%" style="font-weight: bold;">Name</th>
               <th width="20%" style="font-weight: bold;">Details</th>
               <th width="10%" style="font-weight: bold;">Contact Origin</th>
               <th width="15%" style="font-weight: bold;">Status</th>
               <th width="10%" style="font-weight: bold;">Comment</th>
               <th width="10%" style="font-weight: bold;">Country</th>
            </tr>
         </thead>
         <tbody>
         <?php
            foreach($leadInfo as $k=>$v){ 

            $continent = getAllContinentName($v->country);
            if(strtolower($continent) == strtolower("Asia")){
              $backGround = "#FFB300";
            } else if(strtolower($continent) == strtolower("Africa")){
              $backGround = "#FFB300";
            } else if(strtolower($continent) == strtolower("North America")){
              $backGround = "#009792";
            } else if(strtolower($continent) == strtolower("South America")){
              $backGround = "#FF7E00";
            } else if(strtolower($continent) == strtolower("Antarctica")){
              $backGround = "#15E6E8";
            } else if(strtolower($continent) == strtolower("Europe")){
              $backGround = "#0074FF";
            } else if(strtolower($continent) == strtolower("Australia")){
              $backGround = "#05A900";
            } else {
              $backGround = "#FFFFFF";
            }

            if($v->email_status_id == 10){
              $statusBackGround = "#a9d18d";
            } else if($v->email_status_id == 11){
              $statusBackGround = "#ff0000";
            } else if($v->email_status_id == 12){
              $statusBackGround = "#b3c6e7";
            } else if($v->email_status_id == 13){
              $statusBackGround = "#c09200";
            } else if($v->email_status_id == 14){
              $statusBackGround = "#ffff00";
            } else {
              $statusBackGround = "#FFFFFF";
            }

         ?>
            <tr>
               <td> {{ date('m-d-Y',strtotime($v->created_date)) }} </td>
               <td>{{ $v->name }}</td>
               <td>{{ mb_substr($v->message, 0, 300) }}</td> <!-- This line has combination of english and hebrew language-->
               <td>{{ $v->contact_origin }}</td>
               <td style="direction: rtl !important; unicode-bidi: bidi-override; color:black; background-color: {{ $statusBackGround }};">{{ $v->status_name }}</td> <!-- This line has only hebrew language -->
               <td>{{ $v->comment }}</td>
               <td style="color:black; background-color: {{ $backGround }}" >{{ getAllCountryName($v->country) }}</td>
            </tr>
         <?php  }  ?>
         </tbody>
      </table>   

    </body>
    </html>

日期
名称
细节
接触源
地位
评论
国家
{{date('m-d-Y',strottime($v->created_date))}
{{$v->name}
{{mb_substr($v->message,0300)}
{{$v->contact_origin}
{{$v->status_name}
{{$v->comment}
{{getAllCountryName($v->country)}
如果有人能帮我摆脱困境,那就太好了。

Dompdf(0.8.1之前及以后)目前不支持RTL文本()。这是一个错误,但结果充其量也还可以

如果您有兴趣尝试,请通过在以下位置添加以下代码来修改呈现的文本:


您可以使用这个支持rtl语言(如波斯语和阿拉伯语)的软件包


为了改变方向,就在要转换为pdf的html标记中,使用dir=“rtl”

在我来问这个问题之前,我已经浏览了这些链接。我也看到了您对GitHub问题的评论,谢谢您的建议。我会试试看。但现在,我使用了TCPDF,这对我来说很好。在Dompdf获得本机支持之前,这是一个更可行的选择。此外,PDF应该工作良好。
if (strtolower($style->direction) === 'rtl') {
  preg_match_all('/./us', $text, $ar);
  $text = join('',array_reverse($ar[0]));
  // if there are numbers in the string so the next line reverse the number back treat also numbers with dot (decimal) and email
  $text = preg_replace_callback('/\d+-\d+|\d+|\d+\.\d+|\S+@\S+/', function (array $m) { return strrev($m[0]); }, $text);
}