FontSettingsSetFontsFolder Method

Sets the folder where Aspose.Words looks for TrueType fonts when rendering documents or embedding fonts. This is a shortcut to SetFontsFolders(String, Boolean) for setting only one font directory.

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

Syntax

public void SetFontsFolder(
	string fontFolder,
	bool recursive
)

Parameters

fontFolder
Type: SystemString
The folder that contains TrueType fonts.
recursive
Type: SystemBoolean
True to scan the specified folders for fonts recursively.

Examples

Demonstrates how to set the folder Aspose.Words uses to look for TrueType fonts during rendering or embedding of 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.SetFontsFolder(@"C:\MyFonts\", false);

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

See Also