signintech / gopdf

A simple library for generating PDF written in Go lang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error on pdf.AddTTFFont

Xavierxhq opened this issue · comments

Thanks for the great work of this lib. However i have a small problem on printing text after importing a PDF.

i follow the example provided in README file, but error occurred while adding "ttf" font file, the programs are (example-font.ttf does exist, for sure):
err = pdf.AddTTFFont("daysone", "example-font.ttf") if err != nil { panic(err) }
and the error message is: panic: Unrecognized file (font) format [recovered]
panic: Unrecognized file (font) format

Thanks in advance for any answer to this!

i solve it, try to change path into absolute path.

e.g:
../assets/Poppins-Medium.ttf (relative path)
to
/home/codeyzx/Data/programming/go/axion-be/assets/Poppins-Medium.ttf (absolute path)

commented