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

            // Instantiate Pdf object by calling its empty constructor
            Aspose.Pdf.Document doc = new Aspose.Pdf.Document();

            // Create a section in the Pdf object
            Aspose.Pdf.Page page = doc.Pages.Add();

            Aspose.Pdf.Text.TextFragment fragment = new Aspose.Pdf.Text.TextFragment("");

            Aspose.Pdf.Text.TextSegment segment = new Aspose.Pdf.Text.TextSegment(" This is a sample text using Custom font.");
            Aspose.Pdf.Text.TextState ts = new Aspose.Pdf.Text.TextState();
            ts.Font = FontRepository.FindFont("Arial");
            ts.Font.IsEmbedded = true;
            segment.TextState = ts;
            fragment.Segments.Add(segment);
            page.Paragraphs.Add(fragment);

            dataDir = dataDir + "EmbedFontWhileDocCreation_out.pdf";
            // Save PDF Document
            doc.Save(dataDir);
            // ExEnd:EmbedFontWhileDocCreation 
            Console.WriteLine("\nFont embedded successfully in a PDF file.\nFile saved at " + dataDir);
        }
        public static void Run()
        {
            // ExStart:EmbedFontWhileDocCreation
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_WorkingDocuments();

            // Instantiate Pdf object by calling its empty constructor
            Aspose.Pdf.Document doc = new Aspose.Pdf.Document();

            // Create a section in the Pdf object
            Aspose.Pdf.Page page = doc.Pages.Add();

            Aspose.Pdf.Text.TextFragment fragment = new Aspose.Pdf.Text.TextFragment("");

            Aspose.Pdf.Text.TextSegment segment = new Aspose.Pdf.Text.TextSegment(" This is a sample text using Custom font.");
            Aspose.Pdf.Text.TextState   ts      = new Aspose.Pdf.Text.TextState();
            ts.Font            = FontRepository.FindFont("Arial");
            ts.Font.IsEmbedded = true;
            segment.TextState  = ts;
            fragment.Segments.Add(segment);
            page.Paragraphs.Add(fragment);

            dataDir = dataDir + "EmbedFontWhileDocCreation_out_.pdf";
            // Save PDF Document
            doc.Save(dataDir);
            // ExEnd:EmbedFontWhileDocCreation
            Console.WriteLine("\nFont embedded successfully in a PDF file.\nFile saved at " + dataDir);
        }
        public static void Run()
        {
            // ExStart:CreatePDFwithTaggedText
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_WorkingDocuments();

            Document doc = new Document();

            Aspose.Pdf.Page page1 = doc.Pages.Add();
            Aspose.Pdf.Page page2 = doc.Pages.Add();
            Aspose.Pdf.Page page3 = doc.Pages.Add();

            // Create TextState and configure it
            Aspose.Pdf.Text.TextState ts = new Aspose.Pdf.Text.TextState();
            ts.Font = FontRepository.FindFont("Arial");

            // Creating tagged text element i.e. Supported tags P, H,H1-H6
            TaggedPdfBlockLevelTextElement textElement1 = new TaggedPdfBlockLevelTextElement(doc, "P", "text", ts);
            TaggedPdfBlockLevelTextElement textElement2 = new TaggedPdfBlockLevelTextElement(doc, "P", "test1", ts);
            TaggedPdfBlockLevelTextElement textElement3 = new TaggedPdfBlockLevelTextElement(doc, "P", "test2", ts);
            TaggedPdfBlockLevelTextElement textElement4 = new TaggedPdfBlockLevelTextElement(doc, "P", "test3", ts);
            TaggedPdfBlockLevelTextElement textElement5 = new TaggedPdfBlockLevelTextElement(doc, "P", "test4", ts);
            TaggedPdfBlockLevelTextElement textElement6 = new TaggedPdfBlockLevelTextElement(doc, "P", "test5", ts);
            TaggedPdfBlockLevelTextElement textElement7 = new TaggedPdfBlockLevelTextElement(doc, "P", "test6", ts);
            TaggedPdfBlockLevelTextElement textElement8 = new TaggedPdfBlockLevelTextElement(doc, "P", "test7", ts);

            // Add tagged text element to content
            page1.TaggedPdfContent.Add(textElement1);
            page1.TaggedPdfContent.Add(textElement2);
            page1.TaggedPdfContent.Add(textElement3);
            page2.TaggedPdfContent.Add(textElement4);
            page2.TaggedPdfContent.Add(textElement5);
            page3.TaggedPdfContent.Add(textElement6);
            page3.TaggedPdfContent.Add(textElement7);
            page3.TaggedPdfContent.Add(textElement8);

            // Save PDF Document
            doc.Save(dataDir + "PDFwithTaggedText.pdf");
            // ExEnd:CreatePDFwithTaggedText
        }