gofpdf icon indicating copy to clipboard operation
gofpdf copied to clipboard

empty symbol

Open hyzgh opened this issue 5 years ago • 6 comments

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: image

pdf: image

I would like to know whether there is a way to know the text will be empty when generating the pdf.

hyzgh avatar Aug 23 '19 10:08 hyzgh

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 avatar Aug 23 '19 11:08 jung-kurt

@jung-kurt Here it is. 10.txt

hyzgh avatar Aug 23 '19 11:08 hyzgh

Are you sure the font stsong.ttf contains malagasy glyphs?

ArtemKor avatar Oct 04 '19 12:10 ArtemKor

@ArtemKor malagasy glyphs?

hyzgh avatar Oct 04 '19 13:10 hyzgh

@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 avatar Oct 25 '19 16:10 ArtemKor

@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.

hyzgh avatar Oct 26 '19 07:10 hyzgh