We have a Word document (DOC) where we are using Wingdings 2 symbols as radio buttons.
In the rendered PDF the font “Wingdings 2” is not embedded, so the symbols occur wrong, although the font is installed.
In the same document we are using “Wingdings” and this works fine.
First we use Aspose.Word 10.1 and then we update to version 10.6, but this didn’t solve our problem.
Thanks for your inquiry. Could you please attach your input Word document and the generated PDF file here for testing. I will investigate the issue on my side and provide you more information.
While creating a test document I encountered the problem.
I traverse through the FontInfoCollection of the affected documents and the name of both Wingdings fonts starts lower case instead of upper case (“wingdings 2” instead of “Wingdings 2”) like in my created test document which works fine.
But in the case of “wingdings” (Wingdings 1) the font is embedded correct.
Hi
Thanks for your request. You can use DocumentVisitor to change font. However, it would be better if you attach your test document here for testing. You can remove sensitive information from it.
Here is DocumentVisitor that allows to correct the font names:
using Aspose.Words;
using Aspose.Words.Fields;
///
/// Class inherited from DocumentVisitor, that chnges font.
///
class FontChanger: DocumentVisitor
{
///
/// Called when a FieldEnd node is encountered in the document.
///
public override VisitorAction VisitFieldEnd(FieldEnd fieldEnd)
{
// Simply change font name
ResetFont(fieldEnd.Font);
return VisitorAction.Continue;
}
///
/// Called when a FieldSeparator node is encountered in the document.
///
public override VisitorAction VisitFieldSeparator(FieldSeparator fieldSeparator)
{
ResetFont(fieldSeparator.Font);
return VisitorAction.Continue;
}
///
/// Called when a FieldStart node is encountered in the document.
///
public override VisitorAction VisitFieldStart(FieldStart fieldStart)
{
ResetFont(fieldStart.Font);
return VisitorAction.Continue;
}
///
/// Called when a Footnote end is encountered in the document.
///
public override VisitorAction VisitFootnoteEnd(Footnote footnote)
{
ResetFont(footnote.Font);
return VisitorAction.Continue;
}
///
/// Called when a FormField node is encountered in the document.
///
public override VisitorAction VisitFormField(FormField formField)
{
ResetFont(formField.Font);
return VisitorAction.Continue;
}
///
/// Called when a Paragraph end is encountered in the document.
///
public override VisitorAction VisitParagraphEnd(Paragraph paragraph)
{
ResetFont(paragraph.ParagraphBreakFont);
return VisitorAction.Continue;
}
///
/// Called when a Run node is encountered in the document.
///
public override VisitorAction VisitRun(Run run)
{
ResetFont(run.Font);
return VisitorAction.Continue;
}
///
/// Called when a SpecialChar is encountered in the document.
///
public override VisitorAction VisitSpecialChar(SpecialChar specialChar)
{
ResetFont(specialChar.Font);
return VisitorAction.Continue;
}
private void ResetFont(Font font)
{
if (font.Name == "wingdings 2")
font.Name = mNewFont;
}
// Font by default
private string mNewFont = "Wingdings 2";
}