【问题标题】:I am trying to create malayalam pdfs using FPDF. font using meera.ttf It is working but is not working我正在尝试使用 FPDF 创建马拉雅拉姆语 pdf。使用 meera.ttf 的字体它正在工作但不工作
【发布时间】:2014-01-13 21:42:14
【问题描述】:
  • 我正在尝试使用 FPDF 创建马拉雅拉姆语 pdf。

    使用 meera.ttf

    的字体

    它正在工作,但不能正常工作。

    结果是这样的ഇഗലീഷ്

    我想要结果ഇംഗ്ലീഷ്

    代码***

       $pdf = new tFPDF();
       $pdf->AddPage();
       // Add a Unicode font (uses UTF-8)
       $pdf->AddFont('meera','','meera.ttf',true);
       $pdf->SetFont('meera','',14);
       // Load a UTF-8 string from a file and print it
       $txt = file_get_contents('HelloWorld.txt');
       $pdf->Write(8,$txt);
       // Select a standard font (uses windows-1252)
       $pdf->SetFont('meera','',14);
       $pdf->Ln(10);
       $pdf->Write(5,'The file size of this PDF is only 12 KB.');
       $pdf->Output();
       ?>
    

    HelloWorld.txt


    ഇംഗ്ലീഷ്

【问题讨论】:

  • 这与 FPDF 无关,需要使用其他不同的马拉雅拉姆字体。
  • 同意;我经常看到泰卢固语的这个问题。有些字体可以很好地识别字符的上下文,而有些则不行。
  • 试试 mpdf。支持所有语言

标签: php pdf unicode fpdf truetype


【解决方案1】:

我找到了解决方案。 只需下载 mpdf 6.0 并使用以下查询

<?php
include('mpdf.php');
$html = '
<html>
<head>
<style>
body {background-image:url(image.jpg); background-image-resize:6;} 
footer {page-break-after: always;}
</style>
</head>
<body>
<p >ഇംഗ്ലീഷ്</p>

<p style="font-family:Courier New">Malayalam</p>
</body>
</html>';
$mpdf=new mPDF('ml');
$mpdf->WriteHTML($html);
$mpdf->Output();
?>

【讨论】:

  • 这不是答案,而是另一种选择。
【解决方案2】:

我得到了答案,使用 mpdf, 不支持 fpdf 和 tcpdf。

https://mail.google.com/mail/u/0/?shva=1#sent/143096e2010c4a58

下载完整版mPDF v5.7完整安装-下载(.ZIP文件12.8MB)

运行示例/example29_multilingual_autofont.php

例如。 localhost/MPDF57/examples/example29_multilingual_autofont.php

【讨论】:

  • 检查您提供的链接。
猜你喜欢
  • 2013-01-29
  • 2014-04-25
  • 1970-01-01
  • 1970-01-01
  • 2017-06-27
  • 2012-04-19
  • 2014-04-15
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多