Aspose.Pdf.Examples.CSharp.AsposePdfGenerator.TechnicalArticles.FontsEmbedding.Run C# (CSharp) Method

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {
            // ExStart:FontsEmbedding 
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_TechnicalArticles();

            // Instantiate Pdf instance by calling it empty constructor
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

            // Create a section in the Pdf object                       
            Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

            // Create a text paragraph inheriting text format settings from the section
            Aspose.Pdf.Generator.Text text1 = new Aspose.Pdf.Generator.Text(sec1);

            // Add the text paragraph to the section
            sec1.Paragraphs.Add(text1);

            // Create a text segment
            Aspose.Pdf.Generator.Segment s1 = new Aspose.Pdf.Generator.Segment(" This is a sample text using Custom font");

            // Set the font name to the TextInfo.FontName property of segment, where ‘Almonto Snow’ is custom font name
            s1.TextInfo.FontName = "Almonte Snow";

            // Set the value for property to include the font description into Pdf file
            s1.TextInfo.IsFontEmbedded = true;

            // ExStart:IsUnicode
            // Set the value for property to include a subset of font into Pdf file
            s1.TextInfo.IsUnicode = true;
            // ExEnd:IsUnicode

            // Add the text segment to the text paragraph
            text1.Segments.Add(s1);

            // Save the Pdf
            pdf1.Save(dataDir + @"FontsEmbedding_out.pdf");
            // ExEnd:FontsEmbedding            
        }
        public static void FontsEmbeddingUsingHTML()