TCPDF UTF-8. Lithuanian symbols not showing up

前端 未结 15 657
-上瘾入骨i
-上瘾入骨i 2020-12-01 06:47

Im using latest TCPDF version(5.9). But have some strange problems with encoding. I need Lithuanian language symbols like: ąčęėįšųūž. But get only few of it. Other remain li

15条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-01 06:52

    To use TCPDF with special characters like ฿, 포 or others you need to use a unicode font:

    1. download the font here: ftp://ftp.fu-berlin.de/unix/X11/multimedia/MPlayer/contrib/fonts/arialuni.ttf.bz2

    2. create a test pdf file and load this font into TCPDF example:

      $fontname = $pdf->addTTFfont('/var/www/app/images/fonts/arialuni.ttf', 'TrueTypeUnicode', '', 32);

    3. this will create the fonts like:

      application/libraries/tcpdf/fonts/arialuni.ctg.z
      application/libraries/tcpdf/fonts/arialuni.php
      application/libraries/tcpdf/fonts/arialuni.z

    4. now you can set the new font with : $pdf->SetFont('arialuni', '', 10.5);

    5. and now you can use special unicode characters like ฿ and more....

    Source : http://myridia.com/dev_posts/view/852

提交回复
热议问题