We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Different Aspose output on Windows and Linux

I want to create tests for our product which uses Aspose.Words 20.9 for Java 11. Our product reads a DOTX tempate file and it generates a DOCX file. The tests need to succeed on both Windows and Linux (Windows 10 and a headless CentOS Docker-image).

For testing, I force Aspose to use the Noto fonts on both platforms. DOCX and PDF files seem to contain a timestamp, so I also tried PNG and GIF files. Though they look the same (in a browser and in e.g. Beyond Compare), neither their bytes nor their pixels (as read using ImageIO) are identical.

Even HTML output is different between the two Operating Systems (lines are wrapped too soon under Linux). Text-output removes too much formatting to be really useful for this purpose.

How to best compare Aspose output with a reference output?


In case, you are using old version of Aspose.Words for Java we suggest you please use the latest version of Aspose.Words for Java 20.9.

If you still face problem, please attach the following resources here for testing:

  • Your input document.
  • Please attach the output file that shows the undesired behavior.
  • Please attach the expected output file that shows the desired behavior.
  • Please share the screenshots of problematic section of output document.
  • Please create a simple Java application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

I attached the input document and several output documents, generated using Aspose Words 20.9 and Java 11, under Windows 10 and Debian Stretch (docker image openjdk:11.0.1-slim-stretch).
aspose.zip (269.4 KB)

This is code I used to generate them with. You’ll need the Noto fonts as well (in the ‘fonts’ folder) and obviously a license file.
Ticket219625.zip (703 Bytes)

You’ll notice the GIF, PDF and PNG files generated under Debian and Windows 10 are not identical (though they look the same! But remember I’m trying to test for correct rendering, I need a way to automatically verify this).

While preparing all this, I noticed the HTML output is identical in both systems, so I’ll use that for comparing for now (I previously mentioned HTML-output being wrapped incorrectly, but that was me ignoring the font).


Unfortunately, we have not found the difference between both PDF files. Could you please share the screenshot of problematic sections of output documents?

Moreover, please also ZIP and attach the Noto fonts used in your document here for testing. We will investigate the issue and provide you more information on it.

These are the fonts I use: noto fonts.zip (1.9 MB)

Regarding the PDF files: I must have mixed the files somewhere, as they should contain different generation timestamp. I’ve attached them again: pdf2.zip (27.0 KB)


We have opened both files in Adobe reader and both are identical.

Regarding the fonts issue that you are facing, we suggest you please put the Noto fonts in separate directory at both operating system and use following code example. Hope this helps you.

Document doc = new Document(getMyDir() + "Rendering.docx");

// Retrieve the array of environment-dependent font sources that are searched by default
// For example this will contain a "Windows\Fonts\" source on a Windows machines
// We add this array to a new ArrayList to make adding or removing font entries much easier
ArrayList fontSources = new ArrayList(Arrays.asList(FontSettings.getDefaultInstance().getFontsSources()));

// Add a new folder source which will instruct Aspose.Words to search the following folder for fonts
FolderFontSource folderFontSource = new FolderFontSource("C:\\MyFonts\\", true);

// Add the custom folder which contains our fonts to the list of existing font sources

// Convert the ArrayList of source back into a primitive array of FontSource objects
FontSourceBase[] updatedFontSources = (FontSourceBase[]) fontSources.toArray(new FontSourceBase[fontSources.size()]);

// Apply the new set of font sources to use

doc.save(getArtifactsDir() + "Rendering.SetFontsFoldersSystemAndCustomFolder.pdf");

They seem the same indeed, but if you compute a hash you’ll see they are different. Using e.g. BeyondCompare4 you can see some bytes at the end are different.


Please note that Aspose.Words mimics the behavior of MS Word If you convert your document to PDF, the layout of output document will be same. The table, text and images of output document are same when you open the document in any PDF viewer.