[smc-discuss] Displaying proper malayalam text on PDF using Go lang gopdf

Akshay S Dinesh asdofindia at gmail.com
Sat Jan 25 19:19:32 PST 2020


Can you share the generated PDF?

On Sun, 26 Jan, 2020, 08:28 Jeffrey Antony, <jeffreyantony at gmail.com> wrote:

> Hello All,
>
> I am trying to generate a PDF document with Malayalam text using go
> language.
> For this I am using the go pdf library https://github.com/signintech/gopdf
> The issue is that the malayalam text is not displayed properly.
>
> Good Text (as you all know)
> https://i.stack.imgur.com/KN5m1.png
>
> Obtained Text from gopdf (Improper Text)
> https://i.stack.imgur.com/xLN8r.png
>
> Does anyone know how to fix the issue ?
> The font used is
> https://smc.org.in/downloads/fonts/meera/Meera-Regular.ttf
>
> Below is the code used
>>
>> package main
>> import (
>>     "log"
>>     "github.com/signintech/gopdf"
>> )
>> func main() {
>>     pdf := gopdf.GoPdf{}
>>     pdf.Start(gopdf.Config{ PageSize: *gopdf.PageSizeA4 })
>>     pdf.AddPage()
>>     err := pdf.AddTTFFont("Meera-Regular", "Meera-Regular.ttf")
>>     if err != nil {
>>         log.Print(err.Error())
>>         return
>>     }
>>     err = pdf.SetFont("Meera-Regular", "", 14)
>>     if err != nil {
>>         log.Print(err.Error())
>>         return
>>     }
>>     pdf.Cell(nil, "അതിവേഗ ഇംഗ്ലീഷ് നിഘണ്ടു ")
>>     pdf.WritePdf("hello.pdf")
>> }
>
>
>
> Thanks
> Jeffrey Antony
> _______________________________________________
> Swathanthra Malayalam Computing discuss Mailing List
> Project: https://savannah.nongnu.org/projects/smc
> Web: http://smc.org.in | IRC : #smc-project @ freenode
> discuss at lists.smc.org.in
> http://lists.smc.org.in/listinfo.cgi/discuss-smc.org.in
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.smc.org.in/pipermail/discuss-smc.org.in/attachments/20200126/3894a427/attachment-0002.html>


More information about the discuss mailing list