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.

Wed Nov 13, 2024 8:34 am

Hi,
When docx file generated by SpireDoc library (12.6.2 for Java) saved as pdf, text appear corrupted.
But when same file converted to pdf by MS Word we can see text as expected.
image.png

Please help to resolve this issue.

andrei.chorin
 
Posts: 68
Joined: Sun Jan 08, 2023 2:36 pm

Wed Nov 13, 2024 11:22 am

Hi,

Thank you very much for your message.
However, I did not encounter the issue you described when testing with our latest version 12.11.0. You can see my output result in the screenshot below. I suggest you use the new version to test again as it contains more fixes. If there's still any issue, please provide the following information for our further investigation. Thanks in advance!

1. Your system information(e.g., Windows11)
2. The country and regional format in your system (e.g., China/Chinese).

12.11.0: https://www.e-iceblue.cn/Downloads/Spire-Doc-JAVA.html

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 460
Joined: Mon Nov 07, 2022 8:10 am

Thu Nov 14, 2024 9:59 am

Hi,
Thank you for quick answer.
Here is details of my environment:
OS Name Microsoft Windows 10 Pro
Version 10.0.19045 Build 19045
OS Manufacturer Microsoft Corporation
System Type x64-based PC
Locale United States
Time Zone Jerusalem Standard Time
region.png

We getting Hebrew in pdf only in case of Roboto font is not accessible from code.
I've modified code in order to verify custom font exists.
Please help to resolve this issue.

andrei.chorin
 
Posts: 68
Joined: Sun Jan 08, 2023 2:36 pm

Thu Nov 14, 2024 10:08 am

Hi,

Thank you for your reply.
I will investigate and get back to you as soon as possible.

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 460
Joined: Mon Nov 07, 2022 8:10 am

Fri Nov 15, 2024 2:36 am

Hi,

Thank you for the newly provided code.
After further investigation and analysis, I believe the cause of the issue is that the Roboto font you are using does not support the Hebrew language. You can verify this by following these steps:
1. Manually create a new Word document.
2. Enter Hebrew text and set the font to Roboto.
3. Re-select the entered Hebrew text, and you will find that Word automatically changes the displayed font to Times New Roman.

In fact, the Word document created by you using Spire.Doc also uses the Times New Roman font to display the Hebrew text. However, due to the mandatory embedding method you used, the font name displayed in Word is Roboto. But since Roboto does not support this language, when you convert the Word document to a PDF using Microsoft Word, the final font used in the PDF file is also Times New Roman.
Our product follows the same principle during normal conversion, using the font actually used in the Word document (Times New Roman). But after you added document.setEmbedSystemFonts(true); to the code, our product was forced to use the Roboto font. However, since Roboto itself does not support the Hebrew language, this ultimately led to garbled text. I hope you can understand this.

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 460
Joined: Mon Nov 07, 2022 8:10 am

Fri Nov 15, 2024 10:18 am

Hi,
Even after removing these lines we getting font corrupted in PDF.
image.jpg

In addition our JVM is: amazon-corretto-17.0.4.9.1-windows-x64-jdk.
Thanks.

andrei.chorin
 
Posts: 68
Joined: Sun Jan 08, 2023 2:36 pm

Mon Nov 18, 2024 8:42 am

Hello,

Thank you for your reply.
After further verification and analysis, the issue was caused by document.setCustomFontsFolders(robotoPath);. The purpose of this code is to allow the program to use font files from the specified path when the font is not installed in the environment. However, if the font is already installed on the system, there is no need to use this line of code. In this case, the code may have altered the priority of font usage. I have logged this issue in our bug tracking system with the number SPIREDOC-10949. Once the development team resolves the issue, we will inform you promptly. Until then, you can temporarily comment out this line of code. Sorry for any inconvenience caused.

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 460
Joined: Mon Nov 07, 2022 8:10 am

Sun Jan 26, 2025 7:05 am

Hi,
Is issue resolved?

Thanks,
Andrei.

andrei.chorin
 
Posts: 68
Joined: Sun Jan 08, 2023 2:36 pm

Sun Jan 26, 2025 10:11 am

Hi,

Please download the latest Spire.Doc for Java 13.1.3, which contains the fix of this issue. If there's any issue, welcome to contact us.

https://www.e-iceblue.com/Download/doc-for-java.html

Sincerely,
Doris
E-iceblue support team
User avatar

Doris.Liu
 
Posts: 460
Joined: Mon Nov 07, 2022 8:10 am

Return to Spire.Doc

cron