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.

Tue Mar 27, 2018 5:52 am

When I save a document with Chinese content to PDF on Windows 10, the generated PDF has empty text content (fonts are missing).
However on the same machine and same code, the generated XPS (or other formats like images), the Chinese text is visible.
Strangely if I run it on Windows Server 2016, the generated PDF has the text visible and have the fonts embedded.

The question is how XPS can find and substitute fonts on Windows 10 but not PDF? I understand that they removed some fonts on Windows 10 English default installation (docs.microsoft.com/en-us/windows/deployment/windows-10-missing-fonts), however there seems to be problem with PDF font substitution in Spire.PDF because saving as other formats (XPS, image, html) work on the same machine?

Sample DOC with chinese font and generated PDF and XPS are attached.

By the way this is with latest Spire.Doc 6.3.5

dyoungx
 
Posts: 4
Joined: Tue Mar 27, 2018 5:11 am

Tue Mar 27, 2018 9:50 am

Hello,

Thanks for your inquiry.
I have noticed the font used in your doc file is DFKai-SB, your issue might be caused by a lack of the font on your Windows 10 machine. Please make sure that the font has been installed on your system. Hope this can help you. If there is any question, welcome to write back.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1187
Joined: Tue Sep 27, 2016 1:06 am

Tue Mar 27, 2018 10:18 am

Thanks for the reply. Yes, I understand that the exact font may be missing but when saving as XPS via Spire.Doc on the same machine, there is no issue (text is visible but may be with a different Chinese font). So even if the exact font does not exist, Spire.Doc can find a "replacement" font when converting to XPS, however when saving as PDF, Spire.Doc can not find any "replacement" font and the generated PDF does not have any visible text.

Also examining the properties of generated PDF in Adobe Acrobat, I don't see any embedded Chinese font in PDF properties (only some standard latin fonts are listed)

By the way, when I use "PS Conversion", then this time generated PDF has visible text that are only square characters so it's not empty but again does not show Chinese characters.

dyoungx
 
Posts: 4
Joined: Tue Mar 27, 2018 5:11 am

Wed Mar 28, 2018 8:50 am

Hello,

Thanks for your response.
In fact, converting word to XPS and PDF is not the same for the font processing, the former doesn't need to embed fonts, but the later needs to embed. And the mechanism of Word to Pdf conversion is that it doesn't use the replacement font if your system doesn't have the font installed, that's why you got the invisible text. I installed the font DFKai-SB.ttf on Windows 10 machine, and then tested the PS method, the text becomes square characters just like your case. The PS method can automatically embed fonts, but now the font generated here is not embedded in Pdf, which is an obvious error in our product. I have submitted the issue to our dev team for a fix, once there is any update, we will let you know. Sorry for the inconvenience caused.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1187
Joined: Tue Sep 27, 2016 1:06 am

Tue Apr 03, 2018 7:07 am

Hello,

Thanks for your waiting.
After further investigations, we found that the problem was due to the fact that the font was not embedded successfully and adding private font can resolve the issue. Please try this way on your side. If there is any question, welcome to write back.
Sample code:
Code: Select all
Document doc = new Document();
doc.LoadFromFile("C:\\106骞村害绀惧崁鐕熼€犻粸瑁滃姪瑷堢暙.doc");
ToPdfParameterList parms = new ToPdfParameterList();
List<PrivateFontPath> fonts = new List<PrivateFontPath>();
fonts.Add(new PrivateFontPath("DFKai-SB", "C:\\台湾标楷体DFKai-SB.ttf"));
parms.PrivateFontPaths = fonts;
parms.UsePSCoversion = true;
doc.SaveToFile("Result.pdf", parms);

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1187
Joined: Tue Sep 27, 2016 1:06 am

Tue Apr 10, 2018 7:06 am

Hello,

Greetings from E-iceblue.
Did you test the solution I provided? How is your issue now?
Thanks in advance for your valuable feedback and time.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1187
Joined: Tue Sep 27, 2016 1:06 am

Return to Spire.Doc

cron