When there is a font substitution (missing font) event happened, is there a FontSubstitutionHandler available in Apose Slides like this?
If the answer is no, my question would be how could I achieve this requirement? We would like to log this event and to show a warning message in front end accordingly.
At present we don’t have similar property or event handling mechanism for font substitution. However, we are verifying this on our end and will share the feedback with you as soon as we will complete in house investigation for this.
At present the requested support is not available in API. A ticket with ID SLIDESNET-42178 has been created to provide the requested support.
At present the API does offer rule based font substitution that will take place on back end based on set rule automatically. Please check this documentation link and may be this is of help to you.
Our goal is to show the user a warning message telling them they may need to install the missing fonts in order to render/convert the file properly.
Font substitution doesn’t work well for us since our on prem product has to support tens of languages on different OS.The fallback font mainly depends on the user’s OS and we don’t know the fonts in the file uploaded by the end user.
At present, the API does support WarningCallback that you can consider using your end if that suffice the requirements. Please share your kind feedback if there is any thing otherwise required.
public static void Main()
{
LoadOptions loadOptions = new LoadOptions
{
WarningCallback = new WarningCallback()
};
using (Presentation pres = new Presentation("pres.pptx", loadOptions))
{
pres.Slides[0].GetThumbnail(1.0, 1.0).Save("Thumbnail.png", ImageFormat.Png);
}
}
class WarningCallback : IWarningCallback
{
public ReturnAction Warning(IWarningInfo warning)
{
// "DataLoss" WarningType means font substitution
// output:
// "DataLoss: Font will be substituted from xxxxx to {[set of compatible fonts]}"
Console.WriteLine($"{warning.WarningType}: {warning.Description}");
return ReturnAction.Continue;
}
}