DocumentBuilder.insertHtml not understanding html font-lists

Hi
I have discovered a problem when using DocumentBuilder.insertHtml to insert a html fragment into a word document and subsequently generating pdf.

In html it is very common to specify multiple (alternative) fonts in a font tag to make the html more safe on multiple platforms, e.g font=“Helvetica, Arial, Verdana, sans-serif” is a very common specification.

In my simplified testcase based on a real-life error report, i just used: font = “Arial,Verdana”.
the problem is that Aspose treats this string literally, thus failing with an exception upon generating a pdf.

The exception thrown is:
java.lang.IllegalStateException: Cannot find any fonts installed on the system.
at asposewobfuscated.qx.A (TTFontFiler.java:81)
at asposewobfuscated.oa.hc (PalFont.java:24)

and by debugging, I can see (or guess at least, as I obviously can’t see the source code of TTFontFiler) that it is looking for a font actually named “Arial,Verdana”, instead of understanding that this is a specification of 2 font-alternatives.

In our use case, some of the html fragments come from a customer-chosen web-based wysiwyg editor, so we don’t have full control of the generated html-code.

It would be very useful if you could fix this issue in a future version.

A perfect implementation should also handle the generic font-families in a nice way. (CSS currently specifies the following 5 generic font families: sans-serif, serif, cursive, fantasy, monospace (www.w3.org/TR/CSS2/fonts.html#generic-font-families).

Regards Jan Krag

Hi Jan,

Thank you for reporting this problem to us. This is actually the same problem as you reported in another thread:
https://forum.aspose.com/t/79172
You are right, logic of choosing fonts is not very smart at the moment. However, all your suggestions are already implemented in .NET version of Aspose.Words. So once we finish synchronization of .NET and Java versions of Aspose.Words these issues will be automatically fixed. We plan to finish this work in the second half of May. You will be notified.
Best regards.

The issues you have found earlier (filed as 16228) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.