[smc-discuss] Displaying proper malayalam text on PDF using Go lang gopdf
Jeffrey Antony
jeffreyantony at gmail.com
Sat Jan 25 12:29:30 PST 2020
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/20200125/f6689a07/attachment.html>
More information about the discuss
mailing list