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

Free Support Forum - aspose.com

MIME setting in the IIS causing inforrect font issue using .NET

I have been using Aspose.Total for years.

This past weekend I migrated my production server to a new Windows Server 2019 (old one was Windows Server 2012).

All my system works perfectly after the migration but there is a problem with the Aspose component.

The resulting PDF files after a Aspose.Words mailmerge do not have the same font as the template Word document.

On the old server it still works. On my development computer it still works. But on the new server the resulting documents come out with Times New Roman, regardless what the font was in the template Word document.

I need a solution to this problem really quick!

Can you help me?

To further clarify. It is the same Aspose.Words version running on all three computers. The same database and the same template Word documents. It is only the outcome that is different.

This leads me to believe it might be something simple.

I have made sure that the C:Windows\Fonts on the new server has all the font files from the old server (and then some I notice, probably a Windows 2019 thing).

It must be something simple, a setting or something.

@RobertEliasson

Please note that Aspose.Words requires TrueType fonts when rendering document to fixed-page formats (JPEG, PNG, PDF or XPS). You need to install fonts that are used in your document on the machine where you are converting documents to PDF. Please refer to the following articles:

How Aspose.Words Uses True Type Fonts
Font Availability and Substitution

Hi Tahir

Thanks for getting back to me.

However, I have never had to bother with what fonts my clients have used in their templates. It has always worked, for many, many years.

It is only now that I moved the production to a new server that it stopped working. Since I have the same fonts installed in C:\Windows\Fonts it seems to me that that part is not the problem.

Let’s not snow into a complicated font of some sorts. This applies to all my clients’ outcomes, regardless of what the font in their templates were.

Like I mentioned, it still works on my development computer when I run it there. I just cannot work out what the difference is between my old server (and my current development computer) and the new server. It has to be something simple. But I cannot work it out.
Any help would be greatly appreciated.

@RobertEliasson

To get the correct output, the fonts used in the Word document must install on the machine where you are converting document to PDF.

Regarding the issue you are facing, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output PDF file that shows the undesired behavior generated at Windows Server 2019.
  • Please attach the expected output PDF file that shows the desired behavior generated at Windows Server 2012.
  • Please create a standalone console 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.

Hi Tahir

When the same code is being run on both computers using the exact same template and it works on one computer and not the other, then there is no point in my sending you the stuff you asked for. It is just your standard reply.

As I mentioned, it had to be a “setting” of some sort that differs between the computer it worked compared to the one it did not work on.

After a lot of work I finally managed to work out that it was a missing MIME setting in the IIS of the new server.

For file extension: “.fon” I needed to add the MIME type: “application/octet-stream”.
When I did it immediately worked.

image.png (32.0 KB)

@RobertEliasson

It is nice to hear from you that you have solved your issue. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.