pyfpdf
pyfpdf copied to clipboard
Hindi Text not converting properly (Matra and Half Characters)
Hi,
There is an issue in library while using with Hindi language. If you see the example, given on https://pyfpdf.readthedocs.io/en/latest/Unicode/index.html
Screenshots are taken from example in this page and the PDF (link under example)
It shows the correct input of Hindi text
but when converted to PDF https://github.com/reingart/pyfpdf/raw/master/tutorial/unicode.pdf
It shows the WRONG placement of Small Matra (Chhoti e ki matra) and half character. You can notice that the "Chhoti e ki matra" in दुनिया is coming after the character न Same way the half character in नमस्ते is showing like this स्
I am searching to get solution for long time on Google and stackoverflow.com, but no one has the correct solution for this issue.
It would be great if you please look into this issue and get resolved it as soon as possible. Lots of people are facing this issue (based on my search for solution on google).
Regards.
Any update on the Above please.
I am also getting an issue with Hindi font in PDF. But in my case, the Hindi letters are splitting into multiple lines.
pdf.add_font('gargi', '', 'C:\\Windows\\Fonts\\Gargi_2.0.ttf', uni=True)
pdf.set_font('gargi', '', 14)
pdf.write(8, u'Hindi: नमस्ते दुनिया')
pdf.ln(20)
pdf.output("D:/unicode.pdf", 'F')
The output of pdf is show below.
I am having the same issue. Has anyone manage to get this working?
@venkattarigopula and @deepaksharma76, have you manage to get this working. This is really important for my project. We almost launch and just found this issue with Khmer Unicode.
No Solution found yet. I lost that project because was not able to provide correct spellings.
Just curious if there is anything we can do. Maybe I can help out and fix this, and submit a merge request. Just know I have no idea where to start. Can anyone give me some advise?
I think i have a slightly better output, not able to figure out when it splits Same Sample code from the doc pages used with Gargi.ttf font downloaded and placed in the windows fonts folder
"हो। गए, उनका एक समय में बड़ा नाम था। पूरे देश में तालाब बनते थे बनाने वाले भी पूरे देश में थे। कहीं यह विद्या जाति के विद्यालय | सिखाई जाती थी"
Here is what my output looks like
Not sure how to proceed with Unicode, I started experimenting with a Tamil font, given there are no threads for Tamil and I can also understand Hindi using this thread to see if there is any progress.
Happy to research and contribute to making any progress.
PyFPDF is not maintained anymore, you may want to check PyFPDF/fpdf2 as its successor, with a 99%-compatible API
We ensured in the latest version that it can correctly handle thai text: https://github.com/PyFPDF/fpdf2/issues/184
PyFPDF is not maintained anymore, you may want to check PyFPDF/fpdf2 as its successor, with a 99%-compatible API
We ensured in the latest version that it can correctly handle thai text: PyFPDF#184
I am having the same issue even with FPDF2. I have tried using different fonts (Gargi, Mangal, Arjun-Wide, Mukta, Lohit) but all give the wrong result similar to what shown below.
Correct hindi text: इण्टरनेट पर हिन्दी के साधन
What is printed:
Ok.
I really don't know anything about Hindi text and won't be of much help here,
but if you want to help fix this in fpdf2
, you should report it here: https://github.com/PyFPDF/fpdf2/issues
Anyone still need the solution ? Well my problem was not exactly with pdf but i was adding hindi text to a video and faced the same problem with matras. So I tried all different fonts like devnagri, gargi, kamal,etc. then I settled with bhaskar(you need to install bhaskar font on your system). To get proper hindi you need to first convert "नमस्ते, दुनिया!"(unicode) to "Ù×SÌð, ÎéçÙØæ!" (Bhaskar). You can use https://www.pramukhfontconverter.com/hindi .
Yes, we're looking for solution for this. So do you mean we need to convert Unicode to text first before we can actually use it?
Let us grove a try.
Warm regards, Punleu
On Wed, Apr 5, 2023, 12:09 PM ashmitsharma @.***> wrote:
Anyone still need the solution ? Well my problem was not exactly with pdf but i was adding hindi text to a video and faced the same problem with matras. So I tried all different fonts like devnagri, gargi, kamal,etc. then I settled with bhaskar(you need to install bhaskar font on your system). To get proper hindi you need to first convert "नमस्ते, दुनिया!"(unicode) to "Ù×SÌð, ÎéçÙØæ!" (Bhaskar). You can use https://www.pramukhfontconverter.com/hindi .
— Reply to this email directly, view it on GitHub https://github.com/reingart/pyfpdf/issues/109#issuecomment-1496924952, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNGROWZ3EJ6W32IMPT3Z73W7T467ANCNFSM4FHZGG7A . You are receiving this because you commented.Message ID: @.***>
Yes, we're looking for solution for this. So do you mean we need to convert Unicode to text first before we can actually use it? Let us grove a try. Warm regards, Punleu … On Wed, Apr 5, 2023, 12:09 PM ashmitsharma @.> wrote: Anyone still need the solution ? Well my problem was not exactly with pdf but i was adding hindi text to a video and faced the same problem with matras. So I tried all different fonts like devnagri, gargi, kamal,etc. then I settled with bhaskar(you need to install bhaskar font on your system). To get proper hindi you need to first convert "नमस्ते, दुनिया!"(unicode) to "Ù×SÌð, ÎéçÙØæ!" (Bhaskar). You can use https://www.pramukhfontconverter.com/hindi . — Reply to this email directly, view it on GitHub <#109 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNGROWZ3EJ6W32IMPT3Z73W7T467ANCNFSM4FHZGG7A . You are receiving this because you commented.Message ID: @.>
Yes, Instead of bhaskar font you can also use KrutiDev as I didn't find any good converter for bhaskar font but there are many for Unicode to Krutidev.