dongyidao1461 2013-10-20 13:42
浏览 58

在所有页面中修复了tcpdf中的rtl方向

i have a problem with TCPDF library ,i'm generating pdf file usind TCPDF library in arabic language,the file direction is rtl so i used $pdf->setRTL(true); , and every thing is fine in the first page ,put in the second page or third the direction reseted to ltr!!!

this is apice of my code:

$pdf->AddPage();

$l = Array();
$l['a_meta_charset'] = 'UTF-8';
$l['a_meta_dir'] = 'rtl';
$l['a_meta_language'] = '';
$l['w_page'] = '';
$pdf->setLanguageArray($l);
$pdf->SetFont('almohanad', '', 16);
$pdf->setRTL(true); // cehck here if ar or en



$html = '
  <style>
    html{
      direction:rtl;
    }
  </style>

  <div style="direction:rtl">  
    <br/><br/>
    <img src="' . $image . '" />
    <br/>
    <span style="color:green">'.$date.'</span>
    <h5 style="color:gray">'.$title.'</h5>
    <div style="color:blue;direction:rtl">'.$content.'</div>
  </div>
';

$pdf->writeHTML($html, true, false, false, true, "");
$pdf->setRTL(true);
$pdf->lastPage();
#excute the file
$pdf->Output($fileName, 'I');

So my question is: how can I make all pages in tcpdf have the same direction as rtl ???

  • 写回答

1条回答 默认 最新

  • dop20345 2013-11-17 13:50
    关注

    This problem was fixed by Iranians in the TCPDF Class.
    Download TCPDF from http://www.tcpdf.org/
    and run example_018.php in examples

    //Before Write
    // set some language dependent data:
    $lg = Array();
    $lg['a_meta_charset'] = 'UTF-8';
    $lg['a_meta_dir'] = 'rtl';
    $lg['a_meta_language'] = 'fa';
    $lg['w_page'] = 'page';
    
    // set some language-dependent strings (optional)
    $pdf->setLanguageArray($lg);
    
    //After Write
    $pdf->setRTL(true);
    
    评论

报告相同问题?

悬赏问题

  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退