Load Default fonts in Slides (C#. NET )

I tried to load default fonts for slides in .NET its not working. Can you point where i’m doing mistake ?

{
            Aspose.Slides.LoadOptions loadOptions = new Aspose.Slides.LoadOptions(Aspose.Slides.LoadFormat.Auto);

            string[] loadFonts = { Directory.GetCurrentDirectory() + "//fonts//arial.ttf" };
            Console.WriteLine(loadFonts);
            FontsLoader.LoadExternalFonts(loadFonts);

            loadOptions.DefaultRegularFont = "arial";
            loadOptions.DefaultAsianFont = "arial";

            Presentation presentation = new Presentation(docStream, loadOptions);
            Aspose.Slides.License license = new Aspose.Slides.License();
            license.SetLicense(Path.GetFullPath(Directory.GetCurrentDirectory() + "//license//Aspose.Total.lic"));

            presentation.Save(output, Aspose.Slides.Export.SaveFormat.Pdf);
            Console.WriteLine("Done conversion ------------>");
        }

@pravnviji,

I have observed the code shared by you and have not been able to observe the issue incurring on your end. Can you please share the details of issue on your end. Please also make sure that the default fonts that you are using must be available on your machine too.

@mudassir.fayyaz

Thanks for your reply.

         Aspose.Pdf.Text.FontRepository.Sources.Add(new Aspose.Pdf.Text.FolderFontSource(Path.GetFullPath(Directory.GetCurrentDirectory() + "//fonts//")));
        Aspose.Pdf.Text.FontRepository.LoadFonts();
        FontSettings.DefaultInstance.DefaultFontName = "Arial";
        Aspose.Pdf.Text.Font fs = Aspose.Pdf.Text.FontRepository.FindFont("Arial");

I’m loading default fonts before save pdf. Font is available.

@pravnviji,

I have observed the sample code. You are using Aspose.PDF in the code. Can you please confirm this?

Yes im using Aspose.PDF to set default fonts.

@pravnviji,

Using Aspose.PDF to set default fonts has no affect on default font setting of Aspose.Slides. The two APIs are separate and have nothing in common between them. Please visit this documentation link for your kind reference to use default fonts using Aspose.Slides.

1 Like

Thanks Mudassir.

@pravnviji,

You are very welcome.