I am facing a problem with generating pdf in php by using TCPDF library. I need to show the bangla font correctly. I tried to add some bangla font(i.e. SolaimanLipi.ttf, SutonnyOMJ.ttf, Siyamrupali.ttf, Nikosh.ttf and so on). I can see the bangla font on pdf but the font is not display correctly. Its misplaced the word.
By adding this font I see the on the /fonts/ directory there successfully created 3 file “solaimanlipi.ctg.z”,”solaimanlipi.php” and “solaimanlipi.z”. As well as I can see the bangla font on pdf, but this font is misplaced/scattered. I am attaching a picture what I actually see.
This is how it should look (From browser screenshot):
Here is the code to show above result:
I use below code to use that very same font in my pdf:Code:<?php $strData = file_get_contents('./data3.txt'); ?> <html lang="en" dir="ltr"> <head> <meta charset="utf-8" /> <style> @font-face { font-family: myUniFont; src: url(./SolaimanLipi_22-02-2012.ttf); } </style> </head> <body> <span style="font-family: myUniFont;"><?php echo $strData; ?></span> </body> </html>
And It is how it look like in PDF:Code:$strBNFont = TCPDF_FONTS::addTTFfont('./SolaimanLipi_22-02-2012.ttf', 'TrueTypeUnicode', '', 32); $pdf->SetFont($strBNFont, '', 8, '', 'false');
Please advice me how can I display the bangla font correctly.
thanks in advance
best regards





Reply With Quote
