i have created below code for displaying hindi text using arial unicode font in tcpdf
我创建了下面的代码,用于在tcpdf中使用arial unicode字体显示hindi文本
$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');
but it is not getting displayed properly
但它没有正确显示
But in php it showing correct text.
但在PHP中它显示正确的文本。
Please tell me if there is anything wrong.
请告诉我是否有任何错误。
4 个解决方案
#1
1
Try mPDF as an alternative. It is very good and easy to use. Here is an example of how it displays Hindi
尝试mPDF作为替代方案。它非常好用且易于使用。这是一个如何显示印地语的例子
#2
1
I would try mpdf1.com I have tried it before, and it worked with hindi
我会尝试mpdf1.com我之前尝试过,它与印地文合作
#3
0
Something could be wrong with the font.
字体可能有问题。
Try replacing the following lines and trying another font:
尝试替换以下行并尝试其他字体:
$pdf->addTTFfont('fonts/ARIALUNI.TTF', 'TrueTypeUnicode', '', 32);
$pdf->SetFont('arialuni', '', 10,'false');
#4
-1
Try this, it works.
试试这个,它有效。
$mpdf->SetAutoFont();
#1
1
Try mPDF as an alternative. It is very good and easy to use. Here is an example of how it displays Hindi
尝试mPDF作为替代方案。它非常好用且易于使用。这是一个如何显示印地语的例子
#2
1
I would try mpdf1.com I have tried it before, and it worked with hindi
我会尝试mpdf1.com我之前尝试过,它与印地文合作
#3
0
Something could be wrong with the font.
字体可能有问题。
Try replacing the following lines and trying another font:
尝试替换以下行并尝试其他字体:
$pdf->addTTFfont('fonts/ARIALUNI.TTF', 'TrueTypeUnicode', '', 32);
$pdf->SetFont('arialuni', '', 10,'false');
#4
-1
Try this, it works.
试试这个,它有效。
$mpdf->SetAutoFont();