unidoc / unioffice

Pure go library for creating and processing Office Word (.docx), Excel (.xlsx) and Powerpoint (.pptx) documents
https://unidoc.io/unioffice/
Other
4.37k stars 473 forks source link

docx to pdf #472

Closed pingyuan7 closed 2 years ago

pingyuan7 commented 2 years ago

Description

When converting docx to PDF, the format is simply wrong. Fonts, especially when there is Chinese, will not be converted at all.

Expected Behavior

Actual Behavior

Please include a reproducible code snippet or document attachment that demonstrates the issue.

github-actions[bot] commented 2 years ago

Welcome! Thanks for posting your first issue. The way things work here is that while customer issues are prioritized, other issues go into our backlog where they are assessed and fitted into the roadmap when suitable. If you need to get this done, consider buying a license which also enables you to use it in your commercial products. More information can be found on https://unidoc.io/

sampila commented 2 years ago

Hi @pingyuan7 Could you share the DOCX file and code with us?

Best regards, Alip

pingyuan7 commented 2 years ago

func main() {

doc, err := document.Open("test.docx")
if err != nil {
    log.Fatalf("error opening document: %s", err)
}
defer doc.Close()
c := convert.ConvertToPdf(doc)

err = c.WriteToFile("test.pdf")
if err != nil {
    log.Fatalf("error converting document: %s", err)
}

test.docx

test.pdf }

sampila commented 2 years ago

Hi @pingyuan7,

Thank you for the code and files, we are looking into this and will inform you as soon as possible.

sampila commented 2 years ago

We released new version with improvements of font name lookup, you can try to use new UniOffice version v1.21.0

Let us know if you still have issue regarding this.