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

Free Support Forum - aspose.com

Font type is changed after converting word to pdf

Hello guys,

I’m using aspose words (aspose-words-16.8.0-jdk16.jar) in my web application, and i have a template word document which holds some merge fields to be set at runtime.
The default font in my template document is Al-Mohanad (arabic font hugely used in saudi arabia).

My process is done in 2-phases: Set the merge fields, then convert to pdf.
At runtime, the 1st phase is done correctly and the resulted word document is displayed successfully in Al-Mohanad, but when trying to convert the resulted word document to pdf, the final pdf is being created in Arial font with small boxes replacing non-break spaces.

How can i get a final pdf document in Al-Mohanad font, knowing that Al-Mohanad font is installed correctly in the windows server and it’s obvious that aspose.words is able to use it in the first phase when filling merge field and generating word document. So my concern is just why did Aspose decide to substitute my font when converting it finally to PDF.

Attached is my initial word template, the result word and the final pdf.

Here below is the backend code:

Document doc = new Document(clsStaticData.getContextPath() + templatePath);


FontSettings.getDefaultInstance().setFontsFolder(System.getenv(“windir”)+"\Fonts\", false);
/FontSettings.getDefaultInstance().setFontsFolders(new String[] {}, true);/
/* doc.getMailMerge().setTrimWhitespaces(true); */
// Setup mail merge event handler to do the custom work.
doc.getMailMerge().setFieldMergingCallback(new HandleMergeField());

// This is the data for mail merge.
Object[] keyObjects = fields.keySet().toArray();
String[] fieldNames = Arrays.copyOf(keyObjects, keyObjects.length, String[].class);
Object[] fieldValues = fields.values().toArray();

// Execute the mail merge.
doc.getMailMerge().execute(fieldNames, fieldValues);
TmpFile tmpfile = TmpFile.createNew(“Outgoing Letter”, “.pdf”, true);
OutputStream fout = new FileOutputStream(tmpfile.getFileObject());
// Save the finished document.
doc.setWarningCallback(new HandleDocumentWarnings());

Hi Hussein,

Please check:
How Aspose.Words Uses True Type Fonts during rendering to PDF

Please zip and attach following font files here for testing:

  • ‘AL-Mohanad’
  • 'Traditional Arabic’

Best regards,

Attached are the requested fonts.

Please also note that the conditions mentioned in your link are applied in my environment and the fonts are successfully installed on the machine.
Hi Hussein,

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 as WORDSNET-14311 in our issue tracking system. 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 Hussein,

The problem occurs because the provided font uses some obsolete non-Unicode encoding which is not supported by Aspose.Words.

As a workaround you could use Unicode version of “Al-Mohanad” font. It could be downloaded from here:

Or you could use some other Unicode Arabic font. Please let us know, does this fix the issue for you?

Best regards,

The problem is that my client is very strict about using specifically Al-Mohanad font, so he will not accept any other arabic font.

It would be great if we make it work on Al-Mohanad.

Hi Hussein,

We have passed your concern to our product team and will inform you as soon as we have further updates on this topic.

Best regards,


Any updates about the above concern?



Unfortunately this issue turns out to be more complex then we previously thought. This font does not require a simple encoding table but a variant of Arabic shaping. And there seems to be no documentation. I am afraid, the implementation of this issue has been postponed till a later date (no estimates are available at the moment). We will inform you via this thread as soon as this issue is resolved. We apologize for your inconvenience.

2 posts were split to a new topic: Issue during rendering Al-Mohanad font to PDF

The issues you have found earlier (filed as WORDSNET-14311) have been fixed in this Aspose.Words for .NET 20.11 update and this Aspose.Words for Java 20.11 update.

3 posts were merged into an existing topic: AL-Mohanad font