Problem converting Word with Math

Hi,


I am trying to convert a Word document with math embedded in it. When the document is converted, some symbols are missing, for example sigma and the [ ] around a matrix.

Attached are the original Word doc, and screenshots of what is expected and what comes out on the render.

Any idea why this is happening?

Thanks,
Shawn

Hi Shawn,


Thanks for your inquiry.

After an initial test with Aspose.Words for Java 17.4, we were unable to reproduce this issue on our end during rendering your “math.docx” to PDF (please see attached awjavaout-17.4.pdf). We would suggest you please upgrade to the latest version of Aspose.Words for Java. You can download it from the following link:

Download latest version of Aspose.Words for Java

We used the code from the following article for testing this scenario on our end:
Convert a Word Document to PDF in Java

In case the problem still remains, please supply us with the following information:

  • To what format (PDF, DOCX, HTML etc) you are saving your ‘math.docx’ to?
  • Please attach Aspose.Words generated output document which shows the undesired behavior.
  • Please create a standalone runnable simple Java application (source code without compilation errors) that helps us reproduce your problem on our end and attach it here for testing.
  • Please share the details of the development environment (e.g. OS, Java versions) of the machine you’re getting this problem on.
  • What version of Aspose.Words for Java are you currently using?

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

Best regards,

Hi,


Attached is the source file (test.docx), the PDF generated (test.pdf) and the Java program used to convert the file. The matrix on the second page shows the problem.

I have tried the program on both a Mac and Linux (Ubuntu 12.04) and the output is the same.

I am using aspose-words-17.4 on both boxes. Java is version 1.8.0_111-b14 on both boxes.

Thanks.

Shawn
Hi Shawn,

Thanks for your inquiry. We tested the scenario and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSJAVA-1553. Our product team will further look into the details of this problem and we will keep you updated on the status of correction. We apologize for your inconvenience.

Best regards,
Hi Shawn,

Thanks for being patient. Regarding WORDSJAVA-1553, our product team has completed the work on your issue. This looks not to be a problem in Aspose.Words and we will most likely close this issue as 'Not a Bug'. Please see the following details:

There will be no problems if you use/copy the following Windows fonts on your Mac and Linux environments:

  • Times New Roman
  • Calibri
  • Arial Unicode MS
  • MS Sans Serif
  • and Symbol font

Here is how you can reference these fonts:

LoadOptions opt = new LoadOptions();
FontSettings fontSettings = new FontSettings();

// Add Windows' fonts folder etc

addFontFolder(fontSettings, "subst_fonts");

opt.setFontSettings(fontSettings);
com.aspose.words.Document doc = new Document("input.docx", opt);

doc.save("17.5.pdf");

private static void addFontFolder(FontSettings fontSettings, String folder)
{
FontSourceBase[] fontSourceBases = fontSettings.getFontsSources();
FontSourceBase[] newFontSourceBases = new FontSourceBase[fontSourceBases.length + 1];
System.arraycopy(fontSourceBases, 0, newFontSourceBases, 0, fontSourceBases.length);
newFontSourceBases[newFontSourceBases.length - 1] = new FolderFontSource(folder, true);
fontSettings.setFontsSources(newFontSourceBases);
}

Sometimes the IWarningCallback might help. For instance when you would like to know what fonts were substituted.

LoadOptions opt = new LoadOptions();
opt.setWarningCallback(new IWarningCallback()
{
public void warning(WarningInfo warningInfo)
{
if (warningInfo.getWarningType() == WarningType.FONT_SUBSTITUTION)
System.out.println("FONT_SUBSTITUTION EVENT: " + warningInfo.getDescription());
}
});
Document doc = new Document("input.docx", opt);

Hope, this helps.

Best regards,

@shawnd,

The issues you have found earlier (filed as WORDSJAVA-1553) have been fixed in this Aspose.Words for .NET 17.7 update and this Aspose.Words for Java 17.7 update.