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