Retain Font Color Formatting during Word DOCX Template Document to PDF Conversion using Java over Linux

Hi,

My code uses aspose words to convert a word template to PDF. On the word template, there are some text that is white in color. Technically, after conversion, the text should remain as white.
In my Dev environment, it is true. However when I shift the same word template, same code and same aspose library and licence to other environments, the white text was changed to grey in color. Both servers are linux. Any ideas why? I am using Aspose words 18.9

@manyproblems,

We suggest you please upgrade to the latest version of Aspose.Words for Java i.e. 19.5 and see how it goes. Hope, this helps.

In case the problem still remains, please ZIP and upload your sample input Word document and Aspose.Words 19.5 generated PDF file showing the undesired behavior here for testing. We will then investigate the scenario on our end and provide you more information.

Hi,

I tried to upgrade to the latest version. But the issue is still happening. I don’t have any examples currently. Is there any dependencies on the OS of the server that is running the conversion? i.e. Aspose uses the server’s fonts to generate the pdf? It is very strange that only one environment is causing this.

@manyproblems,

Yes, you need to install required fonts (the fonts which are used inside Word document) on the machine where you are performing Word to PDF rendering by using Aspose.Words. To learn about missing fonts, please refer to the following article:

Hi,

But if the document is saved as word document, the white colour stays. If the document is saved as pdf, the white colour turns grey. The document is of word origin. If font has issues, word document should have an issue. Correct?

@manyproblems,

Aspose.Words can produce correct Word document (DOCX, RTF, ODT etc) without requiring fonts. However, fonts are required only when you render to fixed-page formats such as PDF, XPS, Images etc.

Please ZIP and upload your sample input Word document and Aspose.Words 19.6 generated PDF file showing the undesired behavior here for testing. We will then investigate the scenario on our end and provide you more information.

Hi,

Other than the fonts, I realised if a text box with white/no fill border is present in the word document, upon conversion, the border turns grey too. If font is the issue, the border should not be affected.

@manyproblems,

You are right. But unfortunately, it is difficult to say what the problem is without the documents. We need documents to be able to reproduce the problem on our end. It is safe to attach files in the forum. If you attach your documents here, only you and Aspose staff members can download them. You can also remove any sensitive information by replacing it with dummy data instead.

Hi,

After conversion,
image.png (6.0 KB)
Before Conversion
image.png (165 Bytes)

@manyproblems,

Yes, this looks to be an issue in Aspose.Words API. Please ZIP and upload your sample input Word document and Aspose.Words 19.6 generated PDF file showing the undesired behavior here for testing. We will then investigate/reproduce the scenario on our end and log a ticket in our issue tracking system for resolution.

Hi, its a little hard for me to extract the document. But for 2 environments to be working and only one to have issue, can I just extract the jar from the working environments, remove the jar from the environment that is not working and import the jar that is working?

@manyproblems,

Yes, you can make sure that all environments on your end use the same version of Aspose.Words for Java. One way to check the version number is:

  • Rename ‘aspose-words-19.6-jdk17.jar’ to ‘aspose-words-19.6-jdk17.zip’
  • Unzip ‘aspose-words-19.6-jdk17.zip’ file
  • Navigate to ‘META-INF’ folder and then open ‘MANIFEST.MF’ with Notepad to verify the version number. (see ‘Implementation-Version:’)