public interface IFontSavingCallback
Example:
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 void | fontSaving(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 |
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())); } }