Hello All,
I've an issue with Chinese characters not saving to pdf from word.
I've tried direct SaveToFile/SaveToPdf methods , including chinese font, saving fonts but nothing worked. I'm using latest Spire.Doc nuget package
SP.Document document = new SP.Document();
document.LoadFromFile(fileName + ".docx");
document.SaveToFile(fileName + ".pdf", SP.FileFormat.PDF);
Method #2
ParagraphStyle style = new ParagraphStyle(doc);
style.Name = "FontStyle";
style.CharacterFormat.FontName = "宋体";
style.CharacterFormat.FontSize = 20;
doc.Styles.Add(style);
if(Config.LanguageValue.ToLower() == ApiConstants.LanguageCode.Chinese)
{
foreach (Section s in doc.Sections)
{
foreach (var obj in s.Body.ChildObjects)
{
if (obj is Paragraph)
{
(obj as Paragraph).ApplyStyle("FontStyle");
}
}
}
}
doc.SaveToFile(fileName + ".pdf", SP.FileFormat.PDF);
I've tried using IsEmbeddedAllFonts = true too but nothing worked. Please find the attached doc.
Appreciate your immediate help on this.