public static void Run() { // ExStart:GetFontsFolders // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Text(); //The following line shall return folders where font files are searched. //Those are folders that have been added with LoadExternalFonts method as well as system font folders. string[] fontFolders = FontsLoader.GetFontFolders(); // ExEnd:GetFontsFolders }
public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Text(); String[] loadFonts = new String[] { dataDir + "CustomFonts.ttf" }; // Load the custom font directory fonts FontsLoader.LoadExternalFonts(loadFonts); // Do Some work and perform presentation/slides rendering using (Presentation presentation = new Presentation(dataDir + "DefaultFonts.pptx")) presentation.Save(dataDir + "NewFonts_out.pptx", SaveFormat.Pptx); // Clear Font Cachce FontsLoader.ClearCache(); }
public static void Run() { // ExStart:LoadExternalFont // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Text(); // loading presentation uses SomeFont which is not installed on the system using (Presentation pres = new Presentation(dataDir + "presentation.pptx")) { // load SomeFont from file into the byte array byte[] fontData = File.ReadAllBytes(dataDir + "CustomFonts.ttf"); // load font represented as byte array FontsLoader.LoadExternalFont(fontData); // font SomeFont will be available during the rendering or other operations } }