Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Fri Jan 22, 2021 6:26 am

Hi,

I am using version 8.12.14 of Spire.Doc, and when I convert a Word document with emojis they do not look like they are coming through.

Here is some example text, and I have attached screenshots of what it looks like in word, and then in PDF once converted. You can see in the PDF it looks like they have been replaced with empty spaces:

This is how it looks in word:
Word Example.png


This is how it looks in PDF:
PDF Example.png


Is there any setting that I can use so that the emojis come through correctly? Is this a UTF/Unicode issue or something?

This is the code I am using to convert from Word to PDF:

var options = new ToPdfParameterList
{
CreateWordBookmarks = false,
IsEmbeddedAllFonts = true
};
doc.SaveToStream(ms, options);

Cheers,
Felix

[email protected]
 
Posts: 20
Joined: Sat Nov 07, 2015 4:10 am

Fri Jan 22, 2021 8:42 am

Hello,

Thanks for your inquiry.
Please make sure your PC has the fonts used by these emojis installed. Meanwhile, I simulated a Word file with some emojis (their fonts are “Wingdings" font and "Wingdings 2 and are installed on my PC) and then converted it to PDF, the emojis are rendered correctly.

Besides, our Spire.Doc also supports using uninstalled font when converting Doc to PDF, like the following code. You can give it a try on your side.
Code: Select all
            Document doc = new Document();
            doc.LoadFromFile("input.docx");
            ToPdfParameterList options = new ToPdfParameterList()
            {
                PrivateFontPaths = new List<PrivateFontPath>()
                {
                    new PrivateFontPath("wingding",@"D:\wingding.ttf")
                }
            };
            doc.SaveToStream(ms, options);

If the issue persists after trying, please provide your Word file to help us investigate further. Thanks in advance.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Sat Jan 23, 2021 5:05 am

Hi Brian,

Thanks for your response - I'm not using a special font like Windings, this is still just the default 'Arial' font, but these are unicode emoji characters.

Wouldn't my computer have the font installed otherwise they wouldn't be visible on my Word example?

I have attached an example Word document with some unicode characters in them.

Cheers,
Felix

[email protected]
 
Posts: 20
Joined: Sat Nov 07, 2015 4:10 am

Mon Jan 25, 2021 5:38 am

Hello Felix,

Thanks for your sharing.
I directly opened your file in Microsoft Word, but it is inconsistent with the one shown in your screenshot. Only the checkbox symbol is displayed, the two emojis are not displayed correctly, as shown below. How did you add these emojis? Some screenshots may help a lot.
Open in MS Word.png

In addition, regarding the checkbox symbol, its font displayed in Microsoft Word is “Arial”, but if you use Microsoft Word to convert it to PDF, you will find that its font in PDF is “Segoe UI Symbol”, as shown below. This is because Arial does not support the glyph of the checkbox symbol. And Microsoft Word has an internal font replacement mechanism, it will replace the font with another font that supports this glyph during the conversion process.
The font name in PDF.png

But unfortunately, our Spire.Doc does not support this mechanism at present. To render the checkbox symbol correctly, we recommend that you manually change the font of this symbol in the source document to “Segoe UI Symbol”. I also attached the modified Word file for your reference.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Tue Jan 26, 2021 5:17 pm

Hi Brian,

Thanks for your explanation - I just copied unicode text from a website, for example this one: unicode.org/emoji/charts/full-emoji-list.html

You can copy the text from the 'browser column' and you should be able to add it to any text editor (even notepad as the screenshot below shows). However I can't seem to copy it into this editor as it causes a SQL error on your website :)

Screen1.png


Its an official part of unicode font so it should be supported? I have windows 10 and 365 version of Word, the font is showing and is 'Arial' text when I highlight it, its not being replaced by Segoe or anything like that:

Screen2.png


It sounds like I have a font installed that includes these unicode characters whereas you do not for some reason, but they are definitely part of arial on the system I am using. So I would expect the PDF to have these characters/fonts included as well, at least when generated on the same system?

Cheers,
Felix

[email protected]
 
Posts: 20
Joined: Sat Nov 07, 2015 4:10 am

Wed Jan 27, 2021 8:31 am

Hello Felix,

Thanks for your response.
I directly copied an emoji and pasted it in Microsoft Word, but found that its font name is “Segoe UI Symbol”, not “Arial", as shown below.
screenshot1.png

In fact, the maximum Unicode encoding of character supported by the "Arial" font is "\uFEFC" (as shown below), while the Unicode encoding of symbol in the URL you provided is all greater than it. In other words, “Arial” doesn’t support these symbols, its real font should be “Segoe UI Symbol”. Hope you can understand.
screenshot2.png

And regarding converting Word to PDF, our Spire.Doc is converted according to the font name of the text. The font name of your emojis is Arial, but Arial does not actually support these glyphs, which causes these symbols to not be rendered correctly in the PDF generated by our product.
Therefore, I suggest that you manually change the font of these emojis to " Segoe UI Symbol" in Microsoft Word before converting.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Sat Jan 30, 2021 6:11 am

Hi Brian,

Thankyou, when I investigated this more it does look like this is what Word is doing.... how annoying! I think I didn't see this initially because the font was showing 'use body theme', but when I explicitly set the font then I could see it change to Segoe when I look at it manually.

The problem is that we generate the docx programmatically, so unfortunately it seems like it will be quite tricky to find the unicode characters and set the font... but we will see what we can do.

Cheers,
Felix

[email protected]
 
Posts: 20
Joined: Sat Nov 07, 2015 4:10 am

Sat Jan 30, 2021 7:32 am

Hi Brian,

OK, I think we managed to identify and wrap the emoji characters in "Segoe UI Emoji" font which is what word is using, however the characters are still coming out blank after exporting to PDF. Please see the word document attached. I made it simple and it only has the 2 emoji characters. Here is the corresponding word openxml:

Code: Select all
<w:p>
  <w:r>
    <w:rPr>
      <w:rFonts w:ascii="Segoe UI Emoji" w:hAnsi="Segoe UI Emoji" w:cs="Segoe UI Emoji" />
    </w:rPr>
    <w:t xml:space="preserve">[characters here]</w:t>
  </w:r>
</w:p>


Are you seeing that the characters are correctly set as "Segoe UI Emoji"? Is there any reason why it is not coming out when converting to PDF?

Cheers,
Felix

[email protected]
 
Posts: 20
Joined: Sat Nov 07, 2015 4:10 am

Mon Feb 01, 2021 6:26 am

Hello Felix,

Thanks for your response.

Yes, I can see the characters are correctly set as "Segoe UI Emoji". And I tried converting your file to PDF in a similar environment to yours, and indeed found that the emojis are not rendered correctly. I have logged this issue in our bug tracking system with the ticket SPIREDOC-5509. Our Dev team will investigate further and fix it. If there is any update, we will let you know. Apologize for the inconvenience caused.

If you have any other questions related to our products, please feel free to contact us.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Wed Feb 03, 2021 1:31 am

Hi Brian,

Thanks for confirming that, and appreciate this is being followed up. Is there anywhere we can track the status of this issue? Otherwise will look out for it on releases.

Cheers,
Felix

[email protected]
 
Posts: 20
Joined: Sat Nov 07, 2015 4:10 am

Wed Feb 03, 2021 3:39 am

Hello Felix,

Thanks for your response.
Sorry our bug tracking system is not public. We will keep you informed with the status of its correction in this thread.
We are sorry for the inconvenience.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Return to Spire.Doc

cron