【问题标题】:Hindi language not displaying correctly on tcpdf印地语无法在 tcpdf 上正确显示
【发布时间】:2012-11-11 12:38:01
【问题描述】:

我创建了以下代码,用于在 tcpdf 中使用 arial unicode 字体显示印地语文本

$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);


//set some language-dependent strings
$pdf->setLanguageArray($l);

// ---------------------------------------------------------

$pdf->addTTFfont('fonts/ARIALUNI.TTF', 'TrueTypeUnicode', '', 32);
$pdf->SetFont('arialuni', '', 10,'false');

$txt = 'hindi text with arial unicode समृध्दि';

$pdf->Write(0, $txt, '', 0, 'L', true, 0, false, false, 0);

// ---------------------------------------------------------

//Close and output PDF document
$pdf->Output('example_038.pdf', 'I');

但显示不正确

但在 php 中它显示正确的文本。

如果有什么问题请告诉我。

【问题讨论】:

  • 所以我不明白。如果代码有效..问题出在哪里???
  • 您应该添加它正在显示 不同
  • 我想打印 समृध्दि 这个印地语文本,但它在 pdf 中显示不完全相同。这就是问题
  • 在我的 PDF 阅读器中,我可以使用“समृध्दि”搜索在文本中找到这个词。看起来一切正常
  • tcpdf 似乎无法正确识别 utf 字符。 समृध्दि 是一个有点复杂的单词尝试使用简单的 utf8 单词。或在google.com/transliterate/indic 上尝试不同的组合尝试用印地语、马拉地语和其他 devnagri 字体书写,可能会奏效

标签: php utf-8 tcpdf hindi


【解决方案1】:

试试这个,它有效。

$mpdf->SetAutoFont();

【讨论】:

    【解决方案2】:

    字体可能有问题。

    尝试替换以下行并尝试另一种字体:

    $pdf->addTTFfont('fonts/ARIALUNI.TTF', 'TrueTypeUnicode', '', 32);
    $pdf->SetFont('arialuni', '', 10,'false');
    

    【讨论】:

      【解决方案3】:

      我会试试mpdf1.com 我之前尝试过,它适用于印地语

      【讨论】:

        【解决方案4】:

        尝试mPDF 作为替代方案。它非常好且易于使用。 Here is an example 显示印地语的方式

        【讨论】:

          猜你喜欢
          • 2017-12-01
          • 1970-01-01
          • 2012-05-06
          • 2017-05-14
          • 2015-12-06
          • 1970-01-01
          • 1970-01-01
          • 2017-02-12
          • 2023-01-31
          相关资源
          最近更新 更多