Aspose.Pdf.Examples.CSharp.AsposePdfGenerator.Text.EmbedFont.Unicode C# (CSharp) Method

Unicode() public static method

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

            // Instantiate Pdf instance by calling it empty constructor
            Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
            // Set the property to make your application run faster. It will help load the Truetype font faster
            pdf.IsTruetypeFontMapCached = true;
            // Create a section in the Pdf object
            Aspose.Pdf.Generator.Section sec1 = pdf.Sections.Add();

            // To assign a unicode character by it's coding
            Aspose.Pdf.Generator.Text t1 = new Aspose.Pdf.Generator.Text(((char)0x25a0).ToString());
            // Specify the font face name for first segment in text object
            t1.Segments[0].TextInfo.FontName = "Times New Roman";
            // Specify that first segment in text is UniCode
            t1.Segments[0].TextInfo.IsUnicode = true;
            // Add text to paragraphs collection of section object
            sec1.Paragraphs.Add(t1);
            // Save the PDF document
            pdf.Save(dataDir + "Unicode_out.pdf");
            // ExEnd:Unicode
        }
    }