Public API and Backwards Incompatible Changes in Aspose.Slides for .NET 15.1.0
Public API Chages
Fonts substitutions functinality has been added
Possibility to replace font globally across the presentation and temporary for rendering has been added.
New property “FontsManager” of Presentation class has been introduced. FontsManager class has following members:
IFontSubstRuleCollection FontSubstRuleList Property
This collection of IFontSubstRule instances using to substitute fonts during rendering. IFontSubstRule has SourceFont and DestFont properties implementing IFontData interface and ReplaceFontCondition property allowing to choose condition of replacement (“WhenInaccessible” or “Always”).
IFontData[] GetFonts() Method
Using to retrieve all fonts uisng in the current presentation.
ReplaceFont Methods
Using to persistently replace font in the presentation.
The following example shows how to replace font in the presentation:
Presentation pres = new Presentation("PresContainsArialFont.pptx");
IFontData sourceFont = new FontData("Arial");
IFontData destFont = new FontData("Times New Roman");
pres.FontsManager.ReplaceFont(sourceFont, destFont);
pres.Save("PresContainsTimesNoewRomanFont.pptx", SaveFormat.Pptx);
Another example, demonstrates font substitution for rendering when inaccessible:
Presentation pres = new Presentation("PresContainsSomeRareFontFont.pptx");
IFontData sourceFont = new FontData("SomeRareFont");
IFontData destFont = new FontData("Arial");
IFontSubstRule fontSubstRule = new FontSubstRule(
sourceFont, destFont, FontSubstCondition.WhenInaccessible);
IFontSubstRuleCollection fontSubstRuleCollection = new FontSubstRuleCollection();
fontSubstRuleCollection.Add(fontSubstRule);
pres.FontsManager.FontSubstRuleList = fontSubstRuleCollection;
// Arial font will be used instead of SomeRareFont when inaccessible
pres.Slides[0].GetThumbnail();