Skip to content
This repository has been archived by the owner on Nov 13, 2021. It is now read-only.

empty symbol #294

Open
hyzgh opened this issue Aug 23, 2019 · 6 comments
Open

empty symbol #294

hyzgh opened this issue Aug 23, 2019 · 6 comments

Comments

@hyzgh
Copy link
Contributor

hyzgh commented Aug 23, 2019

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.

@jung-kurt
Copy link
Owner

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.

@hyzgh
Copy link
Contributor Author

hyzgh commented Aug 23, 2019

@jung-kurt Here it is. 10.txt

@ArtemKor
Copy link

ArtemKor commented Oct 4, 2019

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

@hyzgh
Copy link
Contributor Author

hyzgh commented Oct 4, 2019

@ArtemKor malagasy glyphs?

@ArtemKor
Copy link

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

@hyzgh
Copy link
Contributor Author

hyzgh commented Oct 26, 2019

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants