Results 1 to 3 of 3

Thread: Bangla (Unicode) font not rendering correctly in tcpdf

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2009
    Posts
    340

    Question Bangla (Unicode) font not rendering correctly in tcpdf

    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):

    Name:  TCPDF-1.png
Views: 3046
Size:  2.5 KB

    Here is the code to show above result:

    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>
    I use below code to use that very same font in my pdf:

    Code:
        $strBNFont = TCPDF_FONTS::addTTFfont('./SolaimanLipi_22-02-2012.ttf', 'TrueTypeUnicode', '', 32);
        $pdf->SetFont($strBNFont, '', 8, '', 'false');
    And It is how it look like in PDF:

    Name:  TCPDF-3.jpg
Views: 2753
Size:  11.2 KB

    Please advice me how can I display the bangla font correctly.

    thanks in advance
    best regards

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2009
    Posts
    340

    Re: Bangla (Unicode) font not rendering correctly in tcpdf

    any help please?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2009
    Posts
    340

    Lightbulb Re: Bangla (Unicode) font not rendering correctly in tcpdf

    i have attached all files that may help you to figure out the issue..


    thanks in advance
    best regards
    Attached Files Attached Files

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width