2017-10-16 100 views
0

对于没有尝试任何东西,我表示歉意。在使用DomPdf在laravel 5.4中创建PDF期间显示希伯来字符

我想在由Larave DOMPDF创建的PDF中显示希伯来字符。

我不知道该怎么做,以及如何实现这一点。我做了一些搜索,但没有运气。 我这是怎么加载PDF文件

PDF::loadView('pdf', ['leadInfo'=>$leadInfo,'leadByContinent'=>$leadByContinent,'leadByStatus'=>$leadByStatus]) 
       ->save(public_path().'/leadPdfs/'.$leadPdfName); 

和PDF刀片文件

<!DOCTYPE html> 
<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"> 

</head> 
<body> 

<table class="lead" cellspacing="0" width="100%" style="font-size: 12px; font-family: 'Arial, Helvetica Neue, Helvetica, 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> {{ Carbon\Carbon::parse($v->created_date)->formatLocalized('%d %b %Y') }} </td> 
      <td>{{ $v->name }}</td> 
      <td>{{ mb_substr($v->message, 0, 300) }}</td> 
      <td>{{ $v->contact_origin }}</td> 
      <td style="color:black; background-color: {{ $statusBackGround }}" >{{ $v->status_name }}</td> 
      <td>{{ $v->comment }}</td> 
      <td style="color:black; background-color: {{ $backGround }}" >{{ getAllCountryName($v->country) }}</td> 
     </tr> 
    <?php } ?> 
    </tbody> 
    </table> 

</body> 
</html> 

,其结果是enter image description here

现在,它显示?????而不是希伯来语字符。

附加信息:数据库中的数据是希伯来语,所以我只是把它取出来放在PDF刀片文件中。

如果有人给我提出任何建议,这将会很棒。

我正在使用Laravel 5.4。

+1

以色列是一个说几种语言的国家。你在问如何在你的pdf中输出希伯来字符?显示你的代码和你试图呈现给PDF的html,包括你正在使用哪种字体(必须支持希伯来字形)。显示你至少读过dompdf中的unicode支持... – sisve

+0

是的,对以色列的知识较少。是的,我试图展示希伯来语。 –

+0

好的。 1)更新你的问题,澄清你问的是希伯来语,而不是以色列国。 2)更新你的问题,并为我们添加足够的源代码来重现你的问题来调试它,包括代码和html。 – sisve

回答