FontSettingsSetFontsFolders Method

Sets the folders where Aspose.Words looks for TrueType fonts when rendering documents or embedding fonts.

Namespace:  Aspose.Words.Fonts
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.8.0


public void SetFontsFolders(
	string[] fontsFolders,
	bool recursive


Type: SystemString
An array of folders that contain TrueType fonts.
Type: SystemBoolean
True to scan the specified folders for fonts recursively.


By default, Aspose.Words looks for fonts installed to the system.

Setting this property resets the cache of all previously loaded fonts.


Demonstrates how to set Aspose.Words to look in multiple folders for TrueType fonts when rendering or embedding fonts.
Document doc = new Document(MyDir + "Rendering.docx");

// Note that this setting will override any default font sources that are being searched by default
// Now only these folders will be searched for fonts when rendering or embedding fonts
// To add an extra font source while keeping system font sources then use both FontSettings.GetFontSources and 
// FontSettings.SetFontSources instead
FontSettings.DefaultInstance.SetFontsFolders(new string[] { @"C:\MyFonts\", @"D:\Misc\Fonts\" }, true);

doc.Save(ArtifactsDir + "Rendering.SetFontsFoldersMultipleFolders.pdf");

See Also