gofpdf
gofpdf copied to clipboard
empty symbol
I use MultiCell to generate a pdf, it works well when there is not missing symbols. But when there are some missing symbols, it will generate a text with some empty, please see the picture in the following.
pdf := gofpdf.New("P", "mm", "A4", "font/")
pdf.AddUTF8Font("stsong", "", "stsong.ttf")
pdf.SetFont("stsong", "", 14)
pdf.AddPage()
txtStr, err := ioutil.ReadFile(fileName)
pdf.MultiCell(0, 7, string(txtStr), "", "", false)
if pdf.Err() {
fmt.Println(pdf.Error())
continue
}
pdf.Ln(-1)
err = pdf.OutputFileAndClose(fileName + ".pdf")
if err != nil {
panic(err)
}
txt:
pdf:
I would like to know whether there is a way to know the text will be empty when generating the pdf.
Thanks for report, @hyzgh. Can you provide the text file referenced by filename
as a file rather than a PNG image? This will assist in solving this.
@jung-kurt Here it is. 10.txt
Are you sure the font stsong.ttf contains malagasy glyphs?
@ArtemKor malagasy glyphs?
@hyzgh Sorry, I made a mistake in defining the alphabet. But the question remains the same: Are you sure the font stsong.ttf contains Tibetan glyphs?
@ArtemKor No, it doesn't. I need to transfer some .txt
files to .pdf
files, but it seems that I could only check .pdf
on my own to confirm whether there is some failing glyphs. And I would like to know whether there is a way to know the text will be empty by the code.