Hello.
We have font issues on one of customer's servers.
I'm trying to implement font substitution warning, but the callback does not get executed.
Finally I ran a simple test and it also does not produce any output.
Here is the code:
@Test
public void saveAsImage() throws Exception {
FontSettings.setFontsFolder("", false);
FontSettings.setDefaultFontName("Arial");
Document doc = new Document(getMyDir() + "BUG_49599_chinese chars.docx");
ImageSaveOptions imageOptions = new ImageSaveOptions(SaveFormat.JPEG);
imageOptions.setWarningCallback(new Examples.HandleDocumentWarnings());
imageOptions.setJpegQuality(80);
doc.save(getMyDir() + "Rendering.JpegCustomOptions Out.jpg", imageOptions);
}
public class HandleDocumentWarnings implements IWarningCallback
{
public void warning(WarningInfo info)
{
// We are only interested in fonts being substituted.
if (info.getWarningType() == WarningType.FONT_SUBSTITUTION) {
System.out.println("Font substitution: " + info.getDescription());
}
}
}
As you can see, it's very simple and callback hast to be called, but it's not.
Is it a bug or am I missing something?
Version used:
Specification-Title: Aspose.Words for Java
Specification-Version: 13.6.0.0
Release-Date: 2013.06.30