com.aspose.words
Interface IFontSavingCallback


public interface IFontSavingCallback 

Implement this interface if you want to receive notifications and control how Aspose.Words saves fonts when exporting a document to HTML format.

Example:

Shows how to define custom logic for handling font exporting when saving to HTML based formats.
public void saveHtmlExportFonts() throws Exception
{
    Document doc = new Document(getMyDir() + "Document.doc");

    // Set the option to export font resources.
    HtmlSaveOptions options = new HtmlSaveOptions(SaveFormat.MHTML);
    options.setExportFontResources(true);
    // Create and pass the object which implements the handler methods.
    options.setFontSavingCallback(new HandleFontSaving());

    doc.save(getMyDir() + "Document.SaveWithFontsExport Out.html", options);
}

public class HandleFontSaving implements IFontSavingCallback
{
    public void fontSaving(FontSavingArgs args) throws Exception
    {
        // You can implement logic here to rename fonts, save to file etc. For this example just print some details about the current font being handled.
        System.out.println(MessageFormat.format("Font Name = {0}, Font Filename = {1}", args.getFontFamilyName(), args.getFontFileName()));
    }
}

Method Summary
abstract voidfontSaving(FontSavingArgs args)
           Called when Aspose.Words is about to save a font resource.
 

Method Detail

fontSaving

public abstract void fontSaving(FontSavingArgs args)
                             throws java.lang.Exception
Called when Aspose.Words is about to save a font resource.

Example:

Shows how to define custom logic for handling font exporting when saving to HTML based formats.
public void saveHtmlExportFonts() throws Exception
{
    Document doc = new Document(getMyDir() + "Document.doc");

    // Set the option to export font resources.
    HtmlSaveOptions options = new HtmlSaveOptions(SaveFormat.MHTML);
    options.setExportFontResources(true);
    // Create and pass the object which implements the handler methods.
    options.setFontSavingCallback(new HandleFontSaving());

    doc.save(getMyDir() + "Document.SaveWithFontsExport Out.html", options);
}

public class HandleFontSaving implements IFontSavingCallback
{
    public void fontSaving(FontSavingArgs args) throws Exception
    {
        // You can implement logic here to rename fonts, save to file etc. For this example just print some details about the current font being handled.
        System.out.println(MessageFormat.format("Font Name = {0}, Font Filename = {1}", args.getFontFamilyName(), args.getFontFileName()));
    }
}

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.