乌尔都语支持与 php 兼容的 PDF 库 [英] Urdu supported PDF library compatible with php

查看:42
本文介绍了乌尔都语支持与 php 兼容的 PDF 库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用过 FPDF 和 TCPDF,两者似乎都不适用于 URDU,例如 FPDF 显然不支持它,但另一方面,TCPDF 支持与乌尔都语具有相同字体字符的波斯语和阿拉伯语.

I have used FPDF and TCPDF and both seems not to work with URDU, for instance FPDF clearly doesn't support it, but on the other hand, TCPDF supports Persian and Arabic which have same font characters as Urdu.

当某些字符正确呈现而其他字符未使用 TCPDF 时,就会出现问题.见下图:

The problem arises when some characters are rendered properly and while others aren't using TCPDF. See the image below:

有没有办法绕过 TCPDF 或其他一些原生支持乌尔都语并与 PHP 兼容的库.

Is there a way around TCPDF or some other library that natively supports Urdu language and is compatible with PHP.

谢谢!

推荐答案

所以这就是我所做的,我复制了 windows 字体 ARIAL UNICODE MS 并粘贴到 tcpdf/fonts/ 文件夹中.

So this is what I did, I copied windows font ARIAL UNICODE MS and pasted into tcpdf/fonts/ folder.

然后我从 tcpdf/examples/

<?php 


    require_once('tcpdf_include.php');
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
    $fontname = TCPDF_FONTS::addTTFfont('../fonts/ARIALUNI.ttf', 'TrueTypeUnicode', '', 32);

?>

这生成了适当的字体文件,可以与 TCPDF 一起使用,也可以与 TCPPDF pdf 类实例一起使用,如下所示:

This generated appropriate font files that could be used with TCPDF and could be used with TCPDF pdf class instance like so:

$pdf->SetFont('arialuni', '', 12);

输出:

现在这按预期工作.

这篇关于乌尔都语支持与 php 兼容的 PDF 库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆