- Code: Select all
document.LoadFromFile(wordFilePath);
// Convert to PDF
document.SaveToFile(pdfFilePath, FileFormat.PDF);
document.Close();
document.Dispose();
The DOCX document to be converted contains various fonts. After conversion, fonts like SimLi (Li Shu) are converted to standard fonts, while others like SimSun (Song Ti\宋体) are normal. Even when converting only the SimLi font, it still fails, despite ensuring that the required font is installed on the system.
SimLi font conversion fails regardless of whether it is bold, italic, or regular. The results vary between Windows 11 and Windows 10, with some cases succeeding and others failing.
I have tried various methods:
(1)Hosting with IIS.
(2)
- Code: Select all
document.setCustomFontsFolders(fontFolder);
(3)
- Code: Select all
parms.PrivateFontPaths.Add(new PrivateFontPath("SimLi", FontStyle.Bold | FontStyle.Italic | FontStyle.Regular, fontPath));
(4)ToPdfParameterList ppl = new ToPdfParameterList();
All have failed.