How can I create Malayalam PDF using TCPDF in PHP?

半腔热情 提交于 2019-12-20 03:57:09

问题


I am trying to create malayalam pdfs using TCPDF. As per the manual, i had converted the fonts (using http://fonts.snm-portal.com/) and had added them. It is working but is not working correctly.

The words like 'ന്യൂഡല്ഹി, ഉത്തരവിട്ടെന്നും, എത്രയും'. are displayed as 'ന^യൂഡല്ഹി, ഉത^തരവിട^ടനെനും, എത^രയും'.

I am using 'kartika.ttf' font now and had tried some other malayalam fonts. The database, tables, fields and the site are in 'utf-8' format.

Is there any solution for this problem? Is it possible to show/save as pdf format using indian fonts?


回答1:


Scratch my last comment. As far as I've been able to find, TCPDF does not support indic scripts. For more information see the comments on this blog post http://thottingal.in/blog/2011/05/07/language-ecosystem-sourashtra/

Python's PyPDFLib http://savannah.nongnu.org/projects/pypdflib should be able to render the sample text you provided correctly however.

I wanted to test that pango, which underlies PyPDFLib, would handle the string you provided above. So I used another package built on it. I rendered it with rsvg. http://rrbits.com/malayalam.pdf [Note: The text should show up in the Kartika font, and I can't really tell if it's 100% correct due to my lack of knowledge, but I do know it's a lot closer than anything I extracted out of TCPDF. My version of pango is also ancient.]



来源:https://stackoverflow.com/questions/14869173/how-can-i-create-malayalam-pdf-using-tcpdf-in-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!