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

FontsEmbeddingUsingHTML() public static method

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

            // Instantiate a pdf document
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

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

            // Create string variables with text containing html tags
            string s = "<html><body><font isUnicode='true' face='Bete Noir NF' size=18><i>Sample text </i>with Custome font Embedded </font><br><font isUnicode='true' face='Courier New' size=10><s>Sample Text </s>in <u>Courier New</u> font</font></body></html>";

            // Create text paragraphs containing HTML text
            Aspose.Pdf.Generator.Text t1 = new Aspose.Pdf.Generator.Text(s);

            // Enable the HTML tag support property
            t1.IsHtmlTagSupported = true;

            // Add the text paragraphs containing HTML text to the section
            sec1.Paragraphs.Add(t1);

            // Save the pdf document
            pdf1.Save( dataDir + "inLineFormated_HtmlSuported_out.pdf");
            // ExEnd:FontsEmbeddingUsingHTML 
        }
    }