Presentation FontSubstitutionHandler for missing fonts

Hi there,

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.

Cheers

@zacxu

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.

@zacxu

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.

Hi @mudassir.fayyaz

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.

Cheers,
Zac

@zacxu

The concerned ticket is going to address the requested requirements.

@zacxu

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;
    }
}

@zacxu

If the shared solution fulfil your requirements and we may close the issue or is there still a feedback that you would like to add in this regard.

Hi @mudassir.fayyaz

I haven’t tried the solution you provided since I am not actively working on it atm and may get back to it in the future.

Thanks a lot.

@zacxu

We will be looking forward to your reply as we need to close the ticket based on your feedback if you agree with shared approach.

@zacxu

Can we close the issue on our end?

Hi @mudassir.fayyaz

I am not working on this at the moment, please feel free to close it.

Cheers,
Zac

@zacxu

Thank you for sharing the feedback.