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

Jeffrey Antony jeffreyantony at gmail.com
Sun Jan 26 02:48:17 PST 2020


Hi,

Generated PDF file is here
https://github.com/signintech/gopdf/files/4113320/hello.pdf


On Sat, Jan 25, 2020 at 9:29 PM 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.smc.org.in/pipermail/discuss-smc.org.in/attachments/20200126/9efb6439/attachment-0002.html>


More information about the discuss mailing list