public static void Run()
        {
            // ExStart:UserDefinedBullets
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Headings();
            // Instntiate the Pdf object by calling its empty constructor
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

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

            /*
             * Create 1st heading in the Pdf object's section with level=1. Then create a text 
             * segment and add it in the heading. Set its UserLabel="98" to use a user defined
             * bullet. You must set BulletFontName to "Symbol" or "ZapfDingbats". After setting
             * all properties, add heading into the paragraphs collection of the section
             */

            Aspose.Pdf.Generator.Heading heading1 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 1);
            Aspose.Pdf.Generator.Segment segment1 = new Aspose.Pdf.Generator.Segment(heading1);
            heading1.Segments.Add(segment1);
            segment1.Content = "Symbol";
            heading1.BulletFontName = "Symbol";
            heading1.UserLabel = "98";
            sec1.Paragraphs.Add(heading1);

            /*
             * Create 2nd heading in the Pdf object's section with level=2. Then create a text 
             * segment and add it in the heading. Set its UserLabel="99" to use a user defined
             * bullet. You must set BulletFontName to "Symbol" or "ZapfDingbats". After setting
             * all properties, add heading into the paragraphs collection of the section
             */

            Aspose.Pdf.Generator.Heading heading2 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 2);
            Aspose.Pdf.Generator.Segment segment2 = new Aspose.Pdf.Generator.Segment(heading2);
            heading2.Segments.Add(segment2);
            segment2.Content = "Symbol";
            heading2.BulletFontName = "Symbol";
            heading2.UserLabel = "99";
            sec1.Paragraphs.Add(heading2);

            /*
             * Create 3rd heading in the Pdf object's section with level=3. Then create a text 
             * segment and add it in the heading. Set its UserLabel="100" to use a user defined
             * bullet. You must set BulletFontName to "Symbol" or "ZapfDingbats". After setting
             * all properties, add heading into the paragraphs collection of the section
             */

            Aspose.Pdf.Generator.Heading heading3 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 3);
            Aspose.Pdf.Generator.Segment segment3 = new Aspose.Pdf.Generator.Segment(heading3);
            heading3.Segments.Add(segment3);
            segment3.Content = "Symbol";
            heading3.BulletFontName = "Symbol";
            heading3.UserLabel = "100";
            sec1.Paragraphs.Add(heading3); 

            pdf1.Save(dataDir + "UserDefinedBullets_out.pdf");
            // ExEnd:UserDefinedBullets   
                
        }
Exemple #2
0
        public static void Run()
        {
            // ExStart:InlineParagraph
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Text();

            // Instantiate Pdf instance by calling its empty constructor
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
            // Create section object and add it to sections collection of PDF
            Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

            // Create a text object
            Aspose.Pdf.Generator.Text text1 = new Aspose.Pdf.Generator.Text();
            // Add text object to paragraphs collection of section
            sec1.Paragraphs.Add(text1);
            // Add sample text to segments collection of text object
            text1.Segments.Add("This is a test for inline");
            // Create segment 2 and add it to segements collection of text object
            Aspose.Pdf.Generator.Segment seg2 = text1.Segments.Add();

            // Create a Image object to contain logo gif.
            Aspose.Pdf.Generator.Image img1 = new Aspose.Pdf.Generator.Image();
            // Specify the image file path
            img1.ImageInfo.File = dataDir + "aspose-logo.jpg";
            // Indicate seg2's InlineParagraph is a image.
            seg2.InlineParagraph = img1;
            dataDir = dataDir + "InlineImage_out_.pdf";
            // Create the result PDF Document
            pdf1.Save(dataDir);
            // ExEnd:InlineParagraph
        }
Exemple #3
0
        public static void Run()
        {
            // ExStart:UserDefinedBullets
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Headings();

            // Instntiate the Pdf object by calling its empty constructor
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

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

            /*
             * Create 1st heading in the Pdf object's section with level=1. Then create a text
             * segment and add it in the heading. Set its UserLabel="98" to use a user defined
             * bullet. You must set BulletFontName to "Symbol" or "ZapfDingbats". After setting
             * all properties, add heading into the paragraphs collection of the section
             */

            Aspose.Pdf.Generator.Heading heading1 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 1);
            Aspose.Pdf.Generator.Segment segment1 = new Aspose.Pdf.Generator.Segment(heading1);
            heading1.Segments.Add(segment1);
            segment1.Content        = "Symbol";
            heading1.BulletFontName = "Symbol";
            heading1.UserLabel      = "98";
            sec1.Paragraphs.Add(heading1);

            /*
             * Create 2nd heading in the Pdf object's section with level=2. Then create a text
             * segment and add it in the heading. Set its UserLabel="99" to use a user defined
             * bullet. You must set BulletFontName to "Symbol" or "ZapfDingbats". After setting
             * all properties, add heading into the paragraphs collection of the section
             */

            Aspose.Pdf.Generator.Heading heading2 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 2);
            Aspose.Pdf.Generator.Segment segment2 = new Aspose.Pdf.Generator.Segment(heading2);
            heading2.Segments.Add(segment2);
            segment2.Content        = "Symbol";
            heading2.BulletFontName = "Symbol";
            heading2.UserLabel      = "99";
            sec1.Paragraphs.Add(heading2);

            /*
             * Create 3rd heading in the Pdf object's section with level=3. Then create a text
             * segment and add it in the heading. Set its UserLabel="100" to use a user defined
             * bullet. You must set BulletFontName to "Symbol" or "ZapfDingbats". After setting
             * all properties, add heading into the paragraphs collection of the section
             */

            Aspose.Pdf.Generator.Heading heading3 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 3);
            Aspose.Pdf.Generator.Segment segment3 = new Aspose.Pdf.Generator.Segment(heading3);
            heading3.Segments.Add(segment3);
            segment3.Content        = "Symbol";
            heading3.BulletFontName = "Symbol";
            heading3.UserLabel      = "100";
            sec1.Paragraphs.Add(heading3);

            pdf1.Save(dataDir + "UserDefinedBullets_out_.pdf");
            // ExEnd:UserDefinedBullets
        }
        public static void Run()
        {
            // ExStart:HyperlinkToWeb
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Hyperlinks();

            // Instantiate Pdf document object
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
            // Create a section in the Pdf
            Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
            // Create text paragraph with the reference of a section
            Aspose.Pdf.Generator.Text text2 = new Aspose.Pdf.Generator.Text(sec1);

            // Add the text paragraph in the paragraphs collection of the section
            sec1.Paragraphs.Add(text2);

            // Add a text segment in the text paragraph
            Aspose.Pdf.Generator.Segment segment2 = text2.Segments.Add("this is a web link");

            // Assign a new instance of hyperlink to hyperlink property of segment
            segment2.Hyperlink = new Aspose.Pdf.Generator.Hyperlink();

            // Set the link type of the text segment to Web
            segment2.Hyperlink.LinkType = Aspose.Pdf.Generator.HyperlinkType.Web;

            // Set the URL of the web location to create a web link for the segment
            segment2.Hyperlink.Url = "http://localhost/popup.htm";

            dataDir = dataDir + "HyperlinkToWeb_out_.pdf";
            // Save the Pdf
            pdf1.Save(dataDir);
            // ExEnd:HyperlinkToWeb
        }
Exemple #5
0
        public static void Run()
        {
            // ExStart:HyperlinkNonPdfFile
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Hyperlinks();

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

            // Create text paragraph with the reference of a section
            Aspose.Pdf.Generator.Text text1 = new Aspose.Pdf.Generator.Text(sec1);

            // Add the text paragraph in the paragraphs collection of the section
            sec1.Paragraphs.Add(text1);

            // Add a text segment in the text paragraph
            Aspose.Pdf.Generator.Segment segment1 = text1.Segments.Add("this is a external file link");

            // Assign a new instance of hyperlink to hyperlink property of segment
            segment1.Hyperlink = new Aspose.Pdf.Generator.Hyperlink();

            // Set the link type of the text segment to File
            segment1.Hyperlink.LinkType = Aspose.Pdf.Generator.HyperlinkType.File;

            // Set the path of the external Non-Pdf file
            segment1.Hyperlink.LinkFile = dataDir + "aspose-logo.jpg";

            dataDir = dataDir + "HyperlinkNonPdfFile_out.pdf";
            // Save the Pdf
            pdf1.Save(dataDir);
            // ExEnd:HyperlinkNonPdfFile
        }
        public static void SecondApproach()
        {
            // ExStart:SecondApproach
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_TechnicalArticles();

            // Create a PDF object
            Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();

            Aspose.Pdf.Generator.Section sec1 = pdf.Sections.Add();
            // Create a text object
            Aspose.Pdf.Generator.Text t1 = new Aspose.Pdf.Generator.Text(sec1);
            // Create a Floating Box object that will hold image file
            Aspose.Pdf.Generator.FloatingBox TextFloatingBox1 = new Aspose.Pdf.Generator.FloatingBox(117, 21);
            // Specify the ZIndex value for TextFloatingBox
            TextFloatingBox1.ZIndex = 1;
            TextFloatingBox1.Left   = -4;
            TextFloatingBox1.Top    = -4;
            // Add Floating box to paragraphs collection of Section1
            sec1.Paragraphs.Add(TextFloatingBox1);

            // Add the text object to Paragraphs collection of FloatingBox
            TextFloatingBox1.Paragraphs.Add(t1);

            Aspose.Pdf.Generator.Segment seg1 = new Aspose.Pdf.Generator.Segment(t1);
            // Add the contents for Segment1
            seg1.Content = "paragraph 3 segment 1";
            // Specify the Font fore color for segement1
            seg1.TextInfo.Color = new Aspose.Pdf.Generator.Color("red");
            // Specify the font size information for segment1
            seg1.TextInfo.FontSize = 12;
            // Specify the value for Opacity of text. Default is 1.0. Use it for multilayer effect
            t1.Opacity = 0F;
            // Add the segment to segments collection of Text1
            t1.Segments.Add(seg1);

            // JPeg image cover the underlayer text
            Aspose.Pdf.Generator.Image image1 = new Aspose.Pdf.Generator.Image(sec1);
            image1.ImageInfo.File          = dataDir + "aspose-logo.jpg";
            image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Jpeg;

            // Create a Floating Box object that will hold image file
            Aspose.Pdf.Generator.FloatingBox ImageFloatingBox = new Aspose.Pdf.Generator.FloatingBox(117, 21);
            // Add Floating box to paragraphs collection of Section1
            sec1.Paragraphs.Add(ImageFloatingBox);

            // Specify the left margin of FloatingBox1
            ImageFloatingBox.Left = -4;
            // Specify the Top margin of FloatingBox1
            ImageFloatingBox.Top = -4;
            // Specify the ZIndex of ImageFloatingBox
            ImageFloatingBox.ZIndex = 2;
            // Add the image file to paragraphs collection of FloatingBox
            ImageFloatingBox.Paragraphs.Add(image1);

            // Save the reusltant PDF document
            pdf.Save(dataDir + @"Multilayer-2ndApproach_out_.pdf");
            // ExEnd:SecondApproach
        }
        public static void SecondApproach()
        {
            // ExStart:SecondApproach
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_TechnicalArticles();

            // Create a PDF object
            Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();

            Aspose.Pdf.Generator.Section sec1 = pdf.Sections.Add();
            // Create a text object 
            Aspose.Pdf.Generator.Text t1 = new Aspose.Pdf.Generator.Text(sec1);
            // Create a Floating Box object that will hold image file
            Aspose.Pdf.Generator.FloatingBox TextFloatingBox1 = new Aspose.Pdf.Generator.FloatingBox(117, 21);
            // Specify the ZIndex value for TextFloatingBox
            TextFloatingBox1.ZIndex = 1;
            TextFloatingBox1.Left = -4;
            TextFloatingBox1.Top = -4;
            // Add Floating box to paragraphs collection of Section1
            sec1.Paragraphs.Add(TextFloatingBox1);

            // Add the text object to Paragraphs collection of FloatingBox
            TextFloatingBox1.Paragraphs.Add(t1);

            Aspose.Pdf.Generator.Segment seg1 = new Aspose.Pdf.Generator.Segment(t1);
            // Add the contents for Segment1
            seg1.Content = "paragraph 3 segment 1";
            // Specify the Font fore color for segement1
            seg1.TextInfo.Color = new Aspose.Pdf.Generator.Color("red");
            // Specify the font size information for segment1
            seg1.TextInfo.FontSize = 12;
            // Specify the value for Opacity of text. Default is 1.0. Use it for multilayer effect
            t1.Opacity = 0F;
            // Add the segment to segments collection of Text1
            t1.Segments.Add(seg1);

            // JPeg image cover the underlayer text
            Aspose.Pdf.Generator.Image image1 = new Aspose.Pdf.Generator.Image(sec1);
            image1.ImageInfo.File = dataDir + "aspose-logo.jpg";
            image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Jpeg;

            // Create a Floating Box object that will hold image file
            Aspose.Pdf.Generator.FloatingBox ImageFloatingBox = new Aspose.Pdf.Generator.FloatingBox(117, 21);
            // Add Floating box to paragraphs collection of Section1
            sec1.Paragraphs.Add(ImageFloatingBox);

            // Specify the left margin of FloatingBox1
            ImageFloatingBox.Left = -4;
            // Specify the Top margin of FloatingBox1
            ImageFloatingBox.Top = -4;
            // Specify the ZIndex of ImageFloatingBox
            ImageFloatingBox.ZIndex = 2;
            // Add the image file to paragraphs collection of FloatingBox
            ImageFloatingBox.Paragraphs.Add(image1);

            // Save the reusltant PDF document
            pdf.Save(dataDir + @"Multilayer-2ndApproach_out.pdf");
            // ExEnd:SecondApproach
        }
        public static void Run()
        {
            // ExStart:SystemBullets
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Headings();
            // Instntiate the Pdf object by calling its empty constructor
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

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

            /*
            * Create 1st heading in the Pdf object's section with level=1. Then create
            * a text segment and add it in the heading. Set its UserLabel="Bullet1" to  
            * use system defined bullet. After setting all properties, add heading into
            * the paragraphs collection of the section
            */

            Aspose.Pdf.Generator.Heading heading1 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 1);
            Aspose.Pdf.Generator.Segment segment1 = new Aspose.Pdf.Generator.Segment(heading1);
            heading1.Segments.Add(segment1);
            segment1.Content = "Bullet1";
            heading1.UserLabel = "Bullet1";
            sec1.Paragraphs.Add(heading1);

            /*
            * Create 2nd heading in the Pdf object's section with level=2. Then create
            * a text segment and add it in the heading. Set its UserLabel="Bullet2" to  
            * use system defined bullet. After setting all properties, add heading into
            * the paragraphs collection of the section
            */

            Aspose.Pdf.Generator.Heading heading2 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 2);
            Aspose.Pdf.Generator.Segment segment2 = new Aspose.Pdf.Generator.Segment(heading2);
            heading2.Segments.Add(segment2);
            segment2.Content = "Bullet2";
            heading2.UserLabel = "Bullet2";
            sec1.Paragraphs.Add(heading2);

            /*
            * Create 3rd heading in the Pdf object's section with level=3. Then create
            * a text segment and add it in the heading. Set its UserLabel="Bullet3" to  
            * use system defined bullet. After setting all properties, add heading into
            * the paragraphs collection of the section
            */

            Aspose.Pdf.Generator.Heading heading3 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 3);
            Aspose.Pdf.Generator.Segment segment3 = new Aspose.Pdf.Generator.Segment(heading3);
            heading3.Segments.Add(segment3);
            segment3.Content = "Bullet3";
            heading3.UserLabel = "Bullet3";
            sec1.Paragraphs.Add(heading3);

            pdf1.Save(dataDir + "SystemBullets_out.pdf");
            // ExEnd:SystemBullets   
                
        }
Exemple #9
0
        public static void Run()
        {
            // ExStart:SystemBullets
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Headings();

            // Instntiate the Pdf object by calling its empty constructor
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

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

            /*
             * Create 1st heading in the Pdf object's section with level=1. Then create
             * a text segment and add it in the heading. Set its UserLabel="Bullet1" to
             * use system defined bullet. After setting all properties, add heading into
             * the paragraphs collection of the section
             */

            Aspose.Pdf.Generator.Heading heading1 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 1);
            Aspose.Pdf.Generator.Segment segment1 = new Aspose.Pdf.Generator.Segment(heading1);
            heading1.Segments.Add(segment1);
            segment1.Content   = "Bullet1";
            heading1.UserLabel = "Bullet1";
            sec1.Paragraphs.Add(heading1);

            /*
             * Create 2nd heading in the Pdf object's section with level=2. Then create
             * a text segment and add it in the heading. Set its UserLabel="Bullet2" to
             * use system defined bullet. After setting all properties, add heading into
             * the paragraphs collection of the section
             */

            Aspose.Pdf.Generator.Heading heading2 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 2);
            Aspose.Pdf.Generator.Segment segment2 = new Aspose.Pdf.Generator.Segment(heading2);
            heading2.Segments.Add(segment2);
            segment2.Content   = "Bullet2";
            heading2.UserLabel = "Bullet2";
            sec1.Paragraphs.Add(heading2);

            /*
             * Create 3rd heading in the Pdf object's section with level=3. Then create
             * a text segment and add it in the heading. Set its UserLabel="Bullet3" to
             * use system defined bullet. After setting all properties, add heading into
             * the paragraphs collection of the section
             */

            Aspose.Pdf.Generator.Heading heading3 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 3);
            Aspose.Pdf.Generator.Segment segment3 = new Aspose.Pdf.Generator.Segment(heading3);
            heading3.Segments.Add(segment3);
            segment3.Content   = "Bullet3";
            heading3.UserLabel = "Bullet3";
            sec1.Paragraphs.Add(heading3);

            pdf1.Save(dataDir + "SystemBullets_out_.pdf");
            // ExEnd:SystemBullets
        }
Exemple #10
0
        public static void Run()
        {
            try
            {
                // ExStart:InlineRadioButton
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Text();

                // Create Pdf Instance
                Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

                // Add A Section
                Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

                // Add Text Paragraph
                Aspose.Pdf.Generator.Text text1 = new Aspose.Pdf.Generator.Text();
                // Add Text Paragraph to paragraphs collection of section
                sec1.Paragraphs.Add(text1);
                // Add a segment with sample text to segments collection of Text Paragraph
                text1.Segments.Add("This is a test for inline radiobutton:    ");

                // Specify Inline Radio button field name
                text1.InlineRadioButtonFieldName = "inlineradio";
                // Specify the checked index for inline radio button
                text1.InlineRadioButtonCheckedIndex = 1;

                // Add segments
                Aspose.Pdf.Generator.Segment seg1 = text1.Segments.Add();

                // 1st Radio Button and set the Inline Paragraph property of segment equal to radioButton
                Aspose.Pdf.Generator.RadioButton radio1 = new Aspose.Pdf.Generator.RadioButton();
                seg1.InlineParagraph = radio1;

                Aspose.Pdf.Generator.Segment seg11 = text1.Segments.Add("radio1  ");
                Aspose.Pdf.Generator.Segment seg2  = text1.Segments.Add();

                Aspose.Pdf.Generator.RadioButton radio2 = new Aspose.Pdf.Generator.RadioButton();
                radio2.ID            = "radio2";
                seg2.InlineParagraph = radio2;

                Aspose.Pdf.Generator.Segment     seg22  = text1.Segments.Add("radio2  ");
                Aspose.Pdf.Generator.Segment     seg3   = text1.Segments.Add();
                Aspose.Pdf.Generator.RadioButton radio3 = new Aspose.Pdf.Generator.RadioButton();
                seg3.InlineParagraph = radio3;

                Aspose.Pdf.Generator.Segment seg33 = text1.Segments.Add("radio3  ");

                // Save the document
                pdf1.Save(dataDir + "InlineRadioButton_out.pdf");
                // ExEnd:InlineRadioButton
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        public static void Run()
        {
            // ExStart:RTLLanguages
            // 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();
            // Create a section in the Pdf object
            pdf.Sections.Add();

            pdf.IsTruetypeFontMapCached = true;
            // Specify the location where to save TruetypeFontMap.xml
            pdf.TruetypeFontMapPath = dataDir + "";

            // Create a text object and pass the string object carrying arabic text in it
            Aspose.Pdf.Generator.Text text1 = new Aspose.Pdf.Generator.Text();
            // Create a segment and add it to segments collection of text object
            Aspose.Pdf.Generator.Segment seg0 = text1.Segments.Add();
            // Specify contents for segment
            seg0.Content = "أسبوز هو بائع عنصر ال";
            Aspose.Pdf.Generator.Segment seg1 = text1.Segments.Add();
            seg1.Content = ".NET";
            Aspose.Pdf.Generator.Segment seg2 = text1.Segments.Add();
            seg2.Content = "البارز";

            // Enable text alignment from right to left
            seg0.TextInfo.IsRightToLeft = true;
            seg1.TextInfo.IsRightToLeft = false;         //default
            seg2.TextInfo.IsRightToLeft = true;

            // Enable unicode character set for the text segment
            seg0.TextInfo.IsUnicode = true;
            seg1.TextInfo.IsUnicode = true;
            seg2.TextInfo.IsUnicode = true;

            // Set Font Name
            seg0.TextInfo.FontName = "Times New Roman";
            seg1.TextInfo.FontName = "Times New Roman";
            seg2.TextInfo.FontName = "Times New Roman";
            // Set font size
            seg0.TextInfo.FontSize = 14;
            seg1.TextInfo.FontSize = 14;
            seg2.TextInfo.FontSize = 14;

            // Align text to right hand side using AlignmentType enumeration
            // Make the text right aligned(The meaning of Alignment.Left and AlignmentType.Right are //exchanged when processing RTL language).
            text1.TextInfo.Alignment = Aspose.Pdf.Generator.AlignmentType.Left;

            pdf.Sections[0].Paragraphs.Add(text1);
            pdf.IsRtlInSegmentMode = true;         //default

            pdf.Save(dataDir + "RTLLanguages_out_.pdf");
            // ExEnd:RTLLanguages
        }
        public static void UsingInlineParagraph()
        {
            // ExStart:UsingInlineParagraph
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_TechnicalArticles();

            // Instantiate a Pdf object by calling its 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();

            //=====================================================//
            //	Header to show an Image inline with text
            //=====================================================//

            // Create Header Section of the document
            Aspose.Pdf.Generator.HeaderFooter header = new Aspose.Pdf.Generator.HeaderFooter(sec1);
            // Set the Odd header for the PDF file
            sec1.OddHeader = header;
            // Set the Even Header for the PDF file
            sec1.EvenHeader = header;

            // Create a Text object
            Aspose.Pdf.Generator.Text txt1 = new Aspose.Pdf.Generator.Text();
            // Add text to Header section of the Pdf file
            header.Paragraphs.Add(txt1);

            // Add the text string to Segment of text object
            txt1.Segments.Add("Aspose.Pdf is a Robust component by");
            // Specify the color & Font information using TextInfo property
            txt1.TextInfo.Color    = new Aspose.Pdf.Generator.Color("Blue");
            txt1.TextInfo.FontName = "Helvetica";
            // Create a new segment to be added to text object
            Aspose.Pdf.Generator.Segment seg1 = txt1.Segments.Add();

            // Create an image object in the section
            Aspose.Pdf.Generator.Image image1 = new Aspose.Pdf.Generator.Image(sec1);
            // Set the path of image file
            image1.ImageInfo.File = dataDir + "aspose-logo.jpg";
            // Set the type of image using ImageFileType enumeration
            image1.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Jpeg;
            // Set the image width Information
            image1.ImageInfo.FixWidth = 150;
            // Indicate seg1's InlineParagraph is a image.
            seg1.InlineParagraph = image1;

            // Create a new segment to be added to text object
            Aspose.Pdf.Generator.Segment seg2 = txt1.Segments.Add("Pty Ltd.");
            seg2.TextInfo.Color = new Aspose.Pdf.Generator.Color("Maroon");

            // Save the Pdf
            pdf1.Save(dataDir + "ImageAndPageNumberInHeaderFooter_UsingInlineParagraph_out.pdf");
            // ExEnd:UsingInlineParagraph
        }
        public static void Run()
        {
            // ExStart:HyperlinkPages
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Hyperlinks();

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

            // Create text paragraph with the reference of a section
            Aspose.Pdf.Generator.Text text1 = new Aspose.Pdf.Generator.Text(sec1);

            // Add the text paragraph in the paragraphs collection of the section
            sec1.Paragraphs.Add(text1);

            // Create a text segment
            Aspose.Pdf.Generator.Segment segment1 = new Aspose.Pdf.Generator.Segment();

            // Add a text segment in the text paragraph
            segment1 = text1.Segments.Add("this is a local link");

            // Set the text in the text segment to be underlined
            segment1.TextInfo.IsUnderline = true;

            // Set the link type of the text segment to Local
            segment1.Hyperlink.LinkType = Aspose.Pdf.Generator.HyperlinkType.Local;

            // Assign the id of the desired paragraph as a target id for the text segment
            segment1.Hyperlink.TargetID = "product1";

            // Create a text paragraph to be linked with the text segment
            Aspose.Pdf.Generator.Text text3 = new Aspose.Pdf.Generator.Text(sec1, "product 1 info ...");

            // Add the text paragraph to paragraphs collection of the section
            sec1.Paragraphs.Add(text3);

            // Set this paragraph to be the first so that it can be displayed in a separate
            // page in the document
            text3.IsFirstParagraph = true;

            // Set the id of this text paragraph to "product1"
            text3.ID = "product1";
            dataDir  = dataDir + "HyperlinkPages_out_.pdf";
            // Save the Pdf
            pdf1.Save(dataDir);
            // ExEnd:HyperlinkPages
        }
        public static void Run()
        {
            // ExStart:XMLAsTemplate
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_AdvanceFeatures();

            // Create a Pdf instance and bind the XML template file to Pdf instance
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
            pdf1.BindXML(dataDir + "Template.xml", null);

            // Get the section and then table from the obtained section of the Pdf that
            // is built from the XML template
            Aspose.Pdf.Generator.Section sec1   = pdf1.Sections["Section1"];
            Aspose.Pdf.Generator.Table   table1 = sec1.Paragraphs["Table1"] as Aspose.Pdf.Generator.Table;

            // Clone a new table
            Aspose.Pdf.Generator.Table table2 = table1.CompleteClone() as Aspose.Pdf.Generator.Table;

            // Change the ID of table2 to "Table2" to make it different from table1
            table2.ID = "Table2";

            // Add table2 into the section
            sec1.Paragraphs.Add(table2);

            // Now there are 2 segments with ID "Item",
            // We change the IDs to make sure they are different
            Aspose.Pdf.Generator.Segment item = sec1.GetObjectByID("Item") as Aspose.Pdf.Generator.Segment;
            item.ID = "Item1";
            item    = sec1.GetObjectByID("Item") as Aspose.Pdf.Generator.Segment;
            item.ID = "Item2";

            // Change the content
            item.Content = "item 2";

            // Now clone section1
            Aspose.Pdf.Generator.Section sec2 = sec1.CompleteClone() as Aspose.Pdf.Generator.Section;

            // Add a cloned section to the Pdf and change the contents of the text segments
            // in the section2 of the Pdf object
            pdf1.Sections.Add(sec2);
            item         = sec2.GetObjectByID("Item1") as Aspose.Pdf.Generator.Segment;
            item.Content = "item1 sec2";
            item         = sec2.GetObjectByID("Item2") as Aspose.Pdf.Generator.Segment;
            item.Content = "item2 sec2";

            // Save the Pdf
            pdf1.Save(dataDir + "XmlTemp_out_.pdf");
            // ExEnd:XMLAsTemplate
        }
        public static void Run()
        {
            // ExStart:SpecifyListItem
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_UtilityFeatures();

            // Instantiate Pdf instance by calling its empty constructor
            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();

            // Add four headings in the section
            for (int Level = 1; Level != 5; Level++)
            {
                Aspose.Pdf.Generator.Heading heading2 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, Level);
                Aspose.Pdf.Generator.Segment segment2 = new Aspose.Pdf.Generator.Segment(heading2);
                heading2.Segments.Add(segment2);
                heading2.IsAutoSequence = true;
                segment2.Content = "this is heading of level ";
                segment2.Content += Level.ToString();

                // Add the heading into Table Of Contents. 
                heading2.IsInList = true;
                sec1.Paragraphs.Add(heading2);
            }

            // Create a graph and add a curve shape to its shapes collection
            Aspose.Pdf.Generator.Graph graph1 = new Aspose.Pdf.Generator.Graph(sec1, 100, 400);
            sec1.Paragraphs.Add(graph1);
            float[] posArr = new float[] { 0, 0, 200, 80, 300, 40, 350, 90 };
            Aspose.Pdf.Generator.Curve curve1 = new Aspose.Pdf.Generator.Curve(graph1, posArr);
            graph1.Shapes.Add(curve1);

            // Add the Graph to the List of Figures
            graph1.IsInList = true;

            dataDir = dataDir + "SpecifyListItem_out.pdf";
            // Save the Pdf
            pdf1.Save(dataDir);
            // ExEnd:SpecifyListItem           
        }
Exemple #16
0
        public static void Run()
        {
            // ExStart:SpecifyListItem
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_UtilityFeatures();

            // Instantiate Pdf instance by calling its empty constructor
            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();

            // Add four headings in the section
            for (int Level = 1; Level != 5; Level++)
            {
                Aspose.Pdf.Generator.Heading heading2 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, Level);
                Aspose.Pdf.Generator.Segment segment2 = new Aspose.Pdf.Generator.Segment(heading2);
                heading2.Segments.Add(segment2);
                heading2.IsAutoSequence = true;
                segment2.Content        = "this is heading of level ";
                segment2.Content       += Level.ToString();

                // Add the heading into Table Of Contents.
                heading2.IsInList = true;
                sec1.Paragraphs.Add(heading2);
            }

            // Create a graph and add a curve shape to its shapes collection
            Aspose.Pdf.Generator.Graph graph1 = new Aspose.Pdf.Generator.Graph(sec1, 100, 400);
            sec1.Paragraphs.Add(graph1);
            float[] posArr = new float[] { 0, 0, 200, 80, 300, 40, 350, 90 };
            Aspose.Pdf.Generator.Curve curve1 = new Aspose.Pdf.Generator.Curve(graph1, posArr);
            graph1.Shapes.Add(curve1);

            // Add the Graph to the List of Figures
            graph1.IsInList = true;

            dataDir = dataDir + "SpecifyListItem_out_.pdf";
            // Save the Pdf
            pdf1.Save(dataDir);
            // ExEnd:SpecifyListItem
        }
Exemple #17
0
        public static void Run()
        {
            // ExStart:AddBookmark
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_UtilityFeatures();

            // Instantiate the Pdf instance
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

            // Set the value that PDF document will be Bookmarked
            pdf1.IsBookmarked = true;
            // Specify bookmark level
            pdf1.BookmarkLevel = 1;

            // Create Section object and add it to PDF
            Aspose.Pdf.Generator.Section sec1     = pdf1.Sections.Add();
            Aspose.Pdf.Generator.Heading heading1 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 1);
            Aspose.Pdf.Generator.Segment segment1 = new Aspose.Pdf.Generator.Segment(heading1);
            heading1.Segments.Add(segment1);
            heading1.IsAutoSequence = true;
            segment1.Content        = "this is heading of level 1";
            sec1.Paragraphs.Add(heading1);
            Aspose.Pdf.Generator.Heading heading2 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 2);
            Aspose.Pdf.Generator.Segment segment2 = new Aspose.Pdf.Generator.Segment(heading2);
            heading2.Segments.Add(segment2);
            heading2.IsAutoSequence = true;
            segment2.Content        = "this is heading of level 2";
            sec1.Paragraphs.Add(heading2);
            Aspose.Pdf.Generator.Heading heading3 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 1);
            Aspose.Pdf.Generator.Segment segment3 = new Aspose.Pdf.Generator.Segment(heading3);
            heading3.Segments.Add(segment3);
            heading3.IsAutoSequence = false;
            heading3.LabelWidth     = 60;
            heading3.UserLabel      = "bullet1";
            segment3.Content        = "this is bullet style 1";
            sec1.Paragraphs.Add(heading3);
            dataDir = dataDir + "AddBookmark_out_.pdf";
            pdf1.Save(dataDir);
            // ExEnd:AddBookmark
        }
        public static void Run()
        {
            // ExStart:HyperlinkOtherPdf
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Hyperlinks();

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

            // Create text paragraph with the reference of a section
            Aspose.Pdf.Generator.Text text1 = new Aspose.Pdf.Generator.Text(sec1); 

            // Add the text paragraph in the paragraphs collection of the section
            sec1.Paragraphs.Add(text1); 

            // Create a text segment
            Aspose.Pdf.Generator.Segment segment1 = new Aspose.Pdf.Generator.Segment();

            // Add a text segment in the text paragraph
            segment1 = text1.Segments.Add("this is a pdf link"); 

            // Set the text in the segment to be underlined
            segment1.TextInfo.IsUnderline = true; 

            // Set the link type of the text segment to Pdf
            segment1.Hyperlink.LinkType = Aspose.Pdf.Generator.HyperlinkType.Pdf; 

            // Set the path of the external document
            segment1.Hyperlink.LinkFile =  dataDir + "input.pdf";

            // Set the page number of the document to which the link is to be created
            segment1.Hyperlink.LinkPageNumber = 2;
   
            dataDir = dataDir + "HyperlinkOtherPdf_out.pdf";
            // Save the Pdf
            pdf1.Save(dataDir);
            // ExEnd:HyperlinkOtherPdf           
        }
        public static void Run()
        {
            // ExStart:AddBookmark
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_UtilityFeatures();

            // Instantiate the Pdf instance 
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

            // Set the value that PDF document will be Bookmarked
            pdf1.IsBookmarked = true;
            // Specify bookmark level
            pdf1.BookmarkLevel = 1;

            // Create Section object and add it to PDF 
            Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
            Aspose.Pdf.Generator.Heading heading1 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 1);
            Aspose.Pdf.Generator.Segment segment1 = new Aspose.Pdf.Generator.Segment(heading1);
            heading1.Segments.Add(segment1);
            heading1.IsAutoSequence = true;
            segment1.Content = "this is heading of level 1";
            sec1.Paragraphs.Add(heading1);
            Aspose.Pdf.Generator.Heading heading2 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 2);
            Aspose.Pdf.Generator.Segment segment2 = new Aspose.Pdf.Generator.Segment(heading2);
            heading2.Segments.Add(segment2);
            heading2.IsAutoSequence = true;
            segment2.Content = "this is heading of level 2";
            sec1.Paragraphs.Add(heading2);
            Aspose.Pdf.Generator.Heading heading3 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 1);
            Aspose.Pdf.Generator.Segment segment3 = new Aspose.Pdf.Generator.Segment(heading3);
            heading3.Segments.Add(segment3);
            heading3.IsAutoSequence = false;
            heading3.LabelWidth = 60;
            heading3.UserLabel = "bullet1";
            segment3.Content = "this is bullet style 1";
            sec1.Paragraphs.Add(heading3);
            dataDir = dataDir + "AddBookmark_out.pdf";
            pdf1.Save(dataDir); 
            // ExEnd:AddBookmark           
        }        
        public static void Run()
        {
            // ExStart:HyperlinkOtherPdf
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Hyperlinks();

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

            // Create text paragraph with the reference of a section
            Aspose.Pdf.Generator.Text text1 = new Aspose.Pdf.Generator.Text(sec1);

            // Add the text paragraph in the paragraphs collection of the section
            sec1.Paragraphs.Add(text1);

            // Create a text segment
            Aspose.Pdf.Generator.Segment segment1 = new Aspose.Pdf.Generator.Segment();

            // Add a text segment in the text paragraph
            segment1 = text1.Segments.Add("this is a pdf link");

            // Set the text in the segment to be underlined
            segment1.TextInfo.IsUnderline = true;

            // Set the link type of the text segment to Pdf
            segment1.Hyperlink.LinkType = Aspose.Pdf.Generator.HyperlinkType.Pdf;

            // Set the path of the external document
            segment1.Hyperlink.LinkFile = dataDir + "input.pdf";

            // Set the page number of the document to which the link is to be created
            segment1.Hyperlink.LinkPageNumber = 2;

            dataDir = dataDir + "HyperlinkOtherPdf_out.pdf";
            // Save the Pdf
            pdf1.Save(dataDir);
            // ExEnd:HyperlinkOtherPdf
        }
        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 Run()
        {
            // ExStart:SetVerticalAlignment
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Text();

            // Create directory if it is not already present.
            bool IsExists = System.IO.Directory.Exists(dataDir);

            if (!IsExists)
            {
                System.IO.Directory.CreateDirectory(dataDir);
            }

            // Instantiate Pdf object by calling its 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 new text paragraph with an initial text segment "Aspose"
            Aspose.Pdf.Generator.Text text1 = new Aspose.Pdf.Generator.Text(sec1, "Aspose");

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

            // Create a new text segment into the text paragraph
            Aspose.Pdf.Generator.Segment seg2 = text1.Segments.Add("TM");

            // Set the vertical alignment of text segment "seg2" to Topline by setting
            // IsBaseline property  ot seg2.TextInfo to true
            seg2.TextInfo.IsBaseline = false;
            // Set the font size information for the segment
            seg2.TextInfo.FontSize = 5;

            // Save the Pdf
            pdf1.Save(dataDir + "SetVerticalAlignment_out_.pdf");
            // ExEnd:SetVerticalAlignment
        }
        public static void Run()
        {
            try
            {
                // ExStart:AddEndnote
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Text();

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

                // Create Section
                Aspose.Pdf.Generator.Section sec = pdf.Sections.Add();

                // Create Text Paragraph
                Aspose.Pdf.Generator.Text text = new Aspose.Pdf.Generator.Text();

                // Create Segment
                Aspose.Pdf.Generator.Segment segment = new Aspose.Pdf.Generator.Segment("This is the First Segment");

                // Create EndNote and Assign an EndNote property of Segment to its object
                Aspose.Pdf.Generator.EndNote endnote1 = new Aspose.Pdf.Generator.EndNote("Endnotes for First Segment");
                segment.EndNote = endnote1;

                // Add Segment in Text Paragraph
                text.Segments.Add(segment);

                // Add Text in Section
                sec.Paragraphs.Add(text);

                // Save the document
                pdf.Save(dataDir + "AddEndnote_out.pdf");
                // ExEnd:AddEndnote
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Exemple #24
0
        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 Run()
        {
            try
            {
                // ExStart:AddEndnote
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Text();

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

                // Create Section
                Aspose.Pdf.Generator.Section sec = pdf.Sections.Add();

                // Create Text Paragraph
                Aspose.Pdf.Generator.Text text = new Aspose.Pdf.Generator.Text();

                // Create Segment
                Aspose.Pdf.Generator.Segment segment = new Aspose.Pdf.Generator.Segment("This is the First Segment");

                // Create EndNote and Assign an EndNote property of Segment to its object
                Aspose.Pdf.Generator.EndNote endnote1 = new Aspose.Pdf.Generator.EndNote("Endnotes for First Segment");
                segment.EndNote = endnote1;

                // Add Segment in Text Paragraph
                text.Segments.Add(segment);

                // Add Text in Section
                sec.Paragraphs.Add(text);

                // Save the document
                pdf.Save(dataDir + "AddEndnote_out_.pdf");
                // ExEnd:AddEndnote
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
        public static void Run()
        {
            // ExStart:SymbolFont
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Text();

            // 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 1st text segment
            Aspose.Pdf.Generator.Segment s1 = new Aspose.Pdf.Generator.Segment(((char)183).ToString());

            // Set the font name to the TextInfo.FontName property of segment
            s1.TextInfo.FontName = "Symbol";

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

            // Create 2nd text segment
            Aspose.Pdf.Generator.Segment s2 = new Aspose.Pdf.Generator.Segment(" the first item");

            // Add 2nd text segment to the text paragraph
            text1.Segments.Add(s2);
 
            dataDir = dataDir + "SymbolFont_out.pdf";
            // Create the result PDF Document
            pdf1.Save(dataDir);
            // ExEnd:SymbolFont
        }
        public static void UsingAsposePdfGenerator()
        {
            // ExStart:UsingAsposePdfGenerator
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_Text();

            // Instantiate Pdf instance
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

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

            // Add 1st paragraph (inheriting the text format settings from the section)
            // to the section
            sec1.Paragraphs.Add(new Aspose.Pdf.Generator.Text(sec1, "This is generator text paragraph with default character spacing"));

            Aspose.Pdf.Generator.Section sec2 = pdf1.Sections.Add();

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

            // Create a segment "seg1" in the paragraph "t2"
            Aspose.Pdf.Generator.Segment seg1 = new Aspose.Pdf.Generator.Segment(t2);
            // Assign some content to the segment
            seg1.Content = "This is generator text paragraph with increased character spacing";
            // Set character spacing of the segment to 2.0
            seg1.TextInfo.CharSpace = 2.0f;

            // Add segment (with character spacing) to the paragraph
            t2.Segments.Add(seg1);
            // Add 2nd text paragraph to the section with overridden text format settings
            sec1.Paragraphs.Add(t2);;
            dataDir = dataDir + "UsingAsposePdfGenerator_out_.pdf";
            // Save resulting PDF document.
            pdf1.Save(dataDir);
            // ExEnd:UsingAsposePdfGenerator
            Console.WriteLine("\nCharacter spacing specified successfully using Aspose Pdf Generator.\nFile saved at " + dataDir);
        }
        public static void Run()
        {
            // ExStart:SymbolFont
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Text();

            // 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 1st text segment
            Aspose.Pdf.Generator.Segment s1 = new Aspose.Pdf.Generator.Segment(((char)183).ToString());

            // Set the font name to the TextInfo.FontName property of segment
            s1.TextInfo.FontName = "Symbol";

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

            // Create 2nd text segment
            Aspose.Pdf.Generator.Segment s2 = new Aspose.Pdf.Generator.Segment(" the first item");

            // Add 2nd text segment to the text paragraph
            text1.Segments.Add(s2);

            dataDir = dataDir + "SymbolFont_out_.pdf";
            // Create the result PDF Document
            pdf1.Save(dataDir);
            // ExEnd:SymbolFont
        }
        public static void UsingAsposePdfGenerator()
        {
            // ExStart:UsingAsposePdfGenerator
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_Text();

            // Instantiate Pdf instance
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

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

            // Add 1st paragraph (inheriting the text format settings from the section)
            // To the section 
            sec1.Paragraphs.Add(new Aspose.Pdf.Generator.Text(sec1, "This is generator text paragraph with default character spacing"));

            Aspose.Pdf.Generator.Section sec2 = pdf1.Sections.Add();

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

            // Create a segment "seg1" in the paragraph "t2"
            Aspose.Pdf.Generator.Segment seg1 = new Aspose.Pdf.Generator.Segment(t2);
            // Assign some content to the segment
            seg1.Content = "This is generator text paragraph with increased character spacing";
            // Set character spacing of the segment to 2.0
            seg1.TextInfo.CharSpace = 2.0f;

            // Add segment (with character spacing) to the paragraph
            t2.Segments.Add(seg1);
            // Add 2nd text paragraph to the section with overridden text format settings
            sec1.Paragraphs.Add(t2); ;
            dataDir = dataDir + "UsingAsposePdfGenerator_out.pdf";
            // Save resulting PDF document.
            pdf1.Save(dataDir);
            // ExEnd:UsingAsposePdfGenerator
            Console.WriteLine("\nCharacter spacing specified successfully using Aspose Pdf Generator.\nFile saved at " + dataDir);
        }
Exemple #30
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Text();

            // Create directory if it is not already present.
            bool IsExists = System.IO.Directory.Exists(dataDir);

            if (!IsExists)
            {
                System.IO.Directory.CreateDirectory(dataDir);
            }


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

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

            //Set text color to blue in the whole section
            sec1.TextInfo.Color = new Aspose.Pdf.Generator.Color("Blue");

            //Add 1st paragraph (inheriting the text format settings from the section)
            //to the section
            sec1.Paragraphs.Add(new Aspose.Pdf.Generator.Text(sec1, "paragraph 1 "));

            //Add 2nd paragraph (inheriting the text format settings from the section)
            //to the section
            sec1.Paragraphs.Add(new Aspose.Pdf.Generator.Text(sec1, "paragraph 2"));

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

            //Create a segment "seg1" in the paragraph "t3"
            Aspose.Pdf.Generator.Segment seg1 = new Aspose.Pdf.Generator.Segment(t3);

            //Assign some content to the segment
            seg1.Content = "paragraph 3 segment 1";

            //Set the color of the segment to red
            seg1.TextInfo.Color = new Aspose.Pdf.Generator.Color("Red");

            //Add segment (with red text color) to the paragraph
            t3.Segments.Add(seg1);

            //Create a new segment "seg2" in the paragraph "t3"
            Aspose.Pdf.Generator.Segment seg2 = new Aspose.Pdf.Generator.Segment(t3);

            //Assign some content to the segment
            seg2.Content = "paragraph 3 segment 2";

            //Set the color of the segment to green
            seg2.TextInfo.Color = new Aspose.Pdf.Generator.Color("Green");

            //Add segment (with green text color) to the paragraph
            t3.Segments.Add(seg2);

            //Add 3rd text paragraph to the section with overridden text format settings
            sec1.Paragraphs.Add(t3);

            //Add 4th paragraph (inheriting the text format settings from the section)
            //to the section
            sec1.Paragraphs.Add(new Aspose.Pdf.Generator.Text(sec1, "paragraph 4"));

            //save the document
            pdf1.Save(dataDir + "InheritTextFormat_out.pdf");
        }
        public static void Main(string[] args)
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");

            // Create directory if it is not already present.
            bool IsExists = System.IO.Directory.Exists(dataDir);

            if (!IsExists)
            {
                System.IO.Directory.CreateDirectory(dataDir);
            }

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

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

            //Set text color to blue in the whole section
            sec1.TextInfo.Color = new Aspose.Pdf.Generator.Color("Blue");

            //Add 1st paragraph (inheriting the text format settings from the section)
            //to the section
            sec1.Paragraphs.Add(new Aspose.Pdf.Generator.Text(sec1, "paragraph 1 "));

            //Add 2nd paragraph (inheriting the text format settings from the section)
            //to the section
            sec1.Paragraphs.Add(new Aspose.Pdf.Generator.Text(sec1, "paragraph 2"));

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

            //Create a segment "seg1" in the paragraph "t3"
            Aspose.Pdf.Generator.Segment seg1 = new Aspose.Pdf.Generator.Segment(t3);

            //Assign some content to the segment
            seg1.Content = "paragraph 3 segment 1";

            //Set the color of the segment to red
            seg1.TextInfo.Color = new Aspose.Pdf.Generator.Color("Red");

            //Add segment (with red text color) to the paragraph
            t3.Segments.Add(seg1);

            //Create a new segment "seg2" in the paragraph "t3"
            Aspose.Pdf.Generator.Segment seg2 = new Aspose.Pdf.Generator.Segment(t3);

            //Assign some content to the segment
            seg2.Content = "paragraph 3 segment 2";

            //Set the color of the segment to green
            seg2.TextInfo.Color = new Aspose.Pdf.Generator.Color("Green");

            //Add segment (with green text color) to the paragraph
            t3.Segments.Add(seg2);

            //Add 3rd text paragraph to the section with overridden text format settings
            sec1.Paragraphs.Add(t3);

            //Add 4th paragraph (inheriting the text format settings from the section)
            //to the section
            sec1.Paragraphs.Add(new Aspose.Pdf.Generator.Text(sec1, "paragraph 4"));

            Aspose.Pdf.Generator.TextInfo info1 = t3.TextInfo.Clone() as Aspose.Pdf.Generator.TextInfo;

            //Modify the font side to 16 pt
            info1.FontSize = 16;

            //Set TextInfo property of the text paragraph to newly cloned instance "info1"
            t3.TextInfo = info1;

            //save the document
            pdf1.Save(dataDir + "output.pdf");
        }
        public static void Main(string[] args)
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");

            // Create directory if it is not already present.
            bool IsExists = System.IO.Directory.Exists(dataDir);
            if (!IsExists)
                System.IO.Directory.CreateDirectory(dataDir);

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

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

            //Set text color to blue in the whole section
            sec1.TextInfo.Color = new Aspose.Pdf.Generator.Color("Blue");

            //Add 1st paragraph (inheriting the text format settings from the section)
            //to the section
            sec1.Paragraphs.Add(new Aspose.Pdf.Generator.Text(sec1, "paragraph 1 "));

            //Add 2nd paragraph (inheriting the text format settings from the section)
            //to the section
            sec1.Paragraphs.Add(new Aspose.Pdf.Generator.Text(sec1, "paragraph 2"));

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

            //Create a segment "seg1" in the paragraph "t3"
            Aspose.Pdf.Generator.Segment seg1 = new Aspose.Pdf.Generator.Segment(t3);

            //Assign some content to the segment
            seg1.Content = "paragraph 3 segment 1";

            //Set the color of the segment to red
            seg1.TextInfo.Color = new Aspose.Pdf.Generator.Color("Red");

            //Add segment (with red text color) to the paragraph
            t3.Segments.Add(seg1);

            //Create a new segment "seg2" in the paragraph "t3"
            Aspose.Pdf.Generator.Segment seg2 = new Aspose.Pdf.Generator.Segment(t3);

            //Assign some content to the segment
            seg2.Content = "paragraph 3 segment 2";

            //Set the color of the segment to green
            seg2.TextInfo.Color = new Aspose.Pdf.Generator.Color("Green");

            //Add segment (with green text color) to the paragraph
            t3.Segments.Add(seg2);

            //Add 3rd text paragraph to the section with overridden text format settings
            sec1.Paragraphs.Add(t3);

            //Add 4th paragraph (inheriting the text format settings from the section)
            //to the section
            sec1.Paragraphs.Add(new Aspose.Pdf.Generator.Text(sec1, "paragraph 4"));

            Aspose.Pdf.Generator.TextInfo info1 = t3.TextInfo.Clone() as Aspose.Pdf.Generator.TextInfo;

            //Modify the font side to 16 pt
            info1.FontSize = 16;

            //Set TextInfo property of the text paragraph to newly cloned instance "info1"
            t3.TextInfo = info1;

            //save the document
            pdf1.Save(dataDir + "output.pdf");
        }
Exemple #33
0
        public static void Main(string[] args)
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");

            //Instantiate PDF instance by calling empty constructor
            Aspose.Pdf.Generator.Pdf pdfConv = new Aspose.Pdf.Generator.Pdf();
            //Create a section in the pdf document
            Aspose.Pdf.Generator.Section sec1 = pdfConv.Sections.Add();

            // Create a Header Section of the PDF file
            Aspose.Pdf.Generator.HeaderFooter header = new Aspose.Pdf.Generator.HeaderFooter(sec1);
            // Set the Odd Header for the PDF file
            sec1.OddHeader = header;
            // set the top margin for the header section
            header.Margin.Top = 20;

            //Instantiate a table object
            Aspose.Pdf.Generator.Table tab1 = new Aspose.Pdf.Generator.Table();
            //Add the table in paragraphs collection of the desired section
            header.Paragraphs.Add(tab1);
            //Set default cell border using BorderInfo object
            tab1.DefaultCellBorder = new Aspose.Pdf.Generator.BorderInfo((int)Aspose.Pdf.Generator.BorderSide.All, 0.1F);
            //Set with column widths of the table
            tab1.ColumnWidths = "60 300";

            Aspose.Pdf.Generator.Image img = new Aspose.Pdf.Generator.Image();
            img.ImageInfo.File          = dataDir + "asposelogo.png";
            img.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Png;

            //Create rows in the table and then cells in the rows
            Aspose.Pdf.Generator.Row row1 = tab1.Rows.Add();

            row1.Cells.Add("Table in Header Section");
            row1.BackgroundColor           = new Aspose.Pdf.Generator.Color("#CCCCCC");
            row1.DefaultCellTextInfo.Color = new Aspose.Pdf.Generator.Color("#6699FF");
            // set the font face for the text in the row
            row1.DefaultCellTextInfo.FontName = "Helvetica";
            // set the row span value for first row as 2
            tab1.Rows[0].Cells[0].ColumnsSpan = 2;

            //Create rows in the table and then cells in the rows
            Aspose.Pdf.Generator.Row row2 = tab1.Rows.Add();
            // set the background color for Row2
            row2.BackgroundColor = new Aspose.Pdf.Generator.Color("#FFFFCC");
            // Add the cell which holds the image
            Aspose.Pdf.Generator.Cell cell2 = row2.Cells.Add();
            // set the image width to 60
            img.ImageInfo.FixWidth = 60;

            Aspose.Pdf.Generator.Text txt2 = new Aspose.Pdf.Generator.Text();
            // Add a text segment to hold image and text together
            Aspose.Pdf.Generator.Segment seg1 = new Aspose.Pdf.Generator.Segment();
            seg1.InlineParagraph = img;
            txt2.Segments.Add(seg1);

            //Add the image to the table cell
            cell2.Paragraphs.Add(txt2);
            row2.Cells.Add("Aspose Logo is looking very lovely !");
            row2.DefaultCellTextInfo.FontName = "Helvetica";
            // set the vertical allignment of the text as center alligned
            row2.Cells[1].VerticalAlignment = Aspose.Pdf.Generator.VerticalAlignmentType.Center;
            row2.Cells[1].Alignment         = Aspose.Pdf.Generator.AlignmentType.Center;

            // save the Pdf file
            pdfConv.Save(dataDir + "Table_in_Header.pdf");
        }
        public static void Main(string[] args)
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");

            //Instantiate PDF instance by calling empty constructor
            Aspose.Pdf.Generator.Pdf pdfConv = new Aspose.Pdf.Generator.Pdf();
            //Create a section in the pdf document
            Aspose.Pdf.Generator.Section sec1 = pdfConv.Sections.Add();

            // Create a Header Section of the PDF file
            Aspose.Pdf.Generator.HeaderFooter header = new Aspose.Pdf.Generator.HeaderFooter(sec1);
            // Set the Odd Header for the PDF file
            sec1.OddHeader = header;
            // set the top margin for the header section
            header.Margin.Top = 20;

            //Instantiate a table object
            Aspose.Pdf.Generator.Table tab1 = new Aspose.Pdf.Generator.Table();
            //Add the table in paragraphs collection of the desired section
            header.Paragraphs.Add(tab1);
            //Set default cell border using BorderInfo object
            tab1.DefaultCellBorder = new Aspose.Pdf.Generator.BorderInfo((int)Aspose.Pdf.Generator.BorderSide.All, 0.1F);
            //Set with column widths of the table
            tab1.ColumnWidths = "60 300";

            Aspose.Pdf.Generator.Image img = new Aspose.Pdf.Generator.Image();
            img.ImageInfo.File = dataDir + "asposelogo.png";
            img.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Png;

            //Create rows in the table and then cells in the rows
            Aspose.Pdf.Generator.Row row1 = tab1.Rows.Add();

            row1.Cells.Add("Table in Header Section");
            row1.BackgroundColor = new Aspose.Pdf.Generator.Color("#CCCCCC");
            row1.DefaultCellTextInfo.Color = new Aspose.Pdf.Generator.Color("#6699FF");
            // set the font face for the text in the row
            row1.DefaultCellTextInfo.FontName = "Helvetica";
            // set the row span value for first row as 2
            tab1.Rows[0].Cells[0].ColumnsSpan = 2;

            //Create rows in the table and then cells in the rows
            Aspose.Pdf.Generator.Row row2 = tab1.Rows.Add();
            // set the background color for Row2
            row2.BackgroundColor = new Aspose.Pdf.Generator.Color("#FFFFCC");
            // Add the cell which holds the image
            Aspose.Pdf.Generator.Cell cell2 = row2.Cells.Add();
            // set the image width to 60
            img.ImageInfo.FixWidth = 60;

            Aspose.Pdf.Generator.Text txt2 = new Aspose.Pdf.Generator.Text();
            // Add a text segment to hold image and text together
            Aspose.Pdf.Generator.Segment seg1 = new Aspose.Pdf.Generator.Segment();
            seg1.InlineParagraph = img;
            txt2.Segments.Add(seg1);

            //Add the image to the table cell
            cell2.Paragraphs.Add(txt2);
            row2.Cells.Add("Aspose Logo is looking very lovely !");
            row2.DefaultCellTextInfo.FontName = "Helvetica";
            // set the vertical allignment of the text as center alligned
            row2.Cells[1].VerticalAlignment = Aspose.Pdf.Generator.VerticalAlignmentType.Center;
            row2.Cells[1].Alignment = Aspose.Pdf.Generator.AlignmentType.Center;

            // save the Pdf file
            pdfConv.Save(dataDir + "Table_in_Header.pdf");
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Text();

            // Create directory if it is not already present.
            bool IsExists = System.IO.Directory.Exists(dataDir);
            if (!IsExists)
                System.IO.Directory.CreateDirectory(dataDir);


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

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

            //Set text color to blue in the whole section 
            sec1.TextInfo.Color = new Aspose.Pdf.Generator.Color("Blue");

            //Add 1st paragraph (inheriting the text format settings from the section)
            //to the section 
            sec1.Paragraphs.Add(new Aspose.Pdf.Generator.Text(sec1, "paragraph 1 "));

            //Add 2nd paragraph (inheriting the text format settings from the section)
            //to the section
            sec1.Paragraphs.Add(new Aspose.Pdf.Generator.Text(sec1, "paragraph 2"));

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

            //Create a segment "seg1" in the paragraph "t3"
            Aspose.Pdf.Generator.Segment seg1 = new Aspose.Pdf.Generator.Segment(t3);

            //Assign some content to the segment
            seg1.Content = "paragraph 3 segment 1";

            //Set the color of the segment to red
            seg1.TextInfo.Color = new Aspose.Pdf.Generator.Color("Red");

            //Add segment (with red text color) to the paragraph
            t3.Segments.Add(seg1);

            //Create a new segment "seg2" in the paragraph "t3"
            Aspose.Pdf.Generator.Segment seg2 = new Aspose.Pdf.Generator.Segment(t3);

            //Assign some content to the segment
            seg2.Content = "paragraph 3 segment 2";

            //Set the color of the segment to green
            seg2.TextInfo.Color = new Aspose.Pdf.Generator.Color("Green");

            //Add segment (with green text color) to the paragraph
            t3.Segments.Add(seg2);

            //Add 3rd text paragraph to the section with overridden text format settings
            sec1.Paragraphs.Add(t3);

            //Add 4th paragraph (inheriting the text format settings from the section)
            //to the section
            sec1.Paragraphs.Add(new Aspose.Pdf.Generator.Text(sec1, "paragraph 4"));

            //save the document
            pdf1.Save(dataDir+ "InheritTextFormat_out.pdf"); 
            
        }
        public static void Run()
        {
            // ExStart:ApplyingNumber
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Headings();

            // Instntiate the Pdf object by calling its empty constructor
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

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

            /*
             * Create 1st heading in the Pdf object's section with level=1. Then create
             * a text segment and add it in the heading. Set its numbering style to "Arab"
             * using HeadingType enumeration. And don't forget to set IsAutoSequence=true.
             * If IsAutoSeguence property is set to true then the heading's sequence is
             * controlled automatically by Aspose.Pdf. After setting all properties, add
             * heading into the paragraphs collection of the section
             */

            Aspose.Pdf.Generator.Heading heading1 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 1);
            Aspose.Pdf.Generator.Segment segment1 = new Aspose.Pdf.Generator.Segment(heading1);
            heading1.Segments.Add(segment1);
            segment1.Content        = "Arab";
            heading1.HeadingType    = Aspose.Pdf.Generator.HeadingType.Arab;
            heading1.IsAutoSequence = true;
            sec1.Paragraphs.Add(heading1);

            /*
             * Create 2nd heading in the Pdf object's section with level=1. Then create
             * a text segment and add it in the heading. Set its numbering style to "RomanUpper"
             * using HeadingType enumeration. And don't forget to set IsAutoSequence=true.
             * If IsAutoSeguence property is set to true then the heading's sequence is
             * controlled automatically by Aspose.Pdf for .NET. After setting all properties, add
             * heading into the paragraphs collection of the section
             */

            Aspose.Pdf.Generator.Heading heading2 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 1);
            Aspose.Pdf.Generator.Segment segment2 = new Aspose.Pdf.Generator.Segment(heading2);
            heading2.Segments.Add(segment2);
            segment2.Content        = "RomanUpper";
            heading2.HeadingType    = Aspose.Pdf.Generator.HeadingType.RomanUpper;
            heading2.IsAutoSequence = true;
            sec1.Paragraphs.Add(heading2);

            /*
             * Create 3rd heading in the Pdf object's section with level=1. Then create
             * a text segment and add it in the heading. Set its numbering style to "RomanLower"
             * using HeadingType enumeration. And don't forget to set IsAutoSequence=true.
             * If IsAutoSeguence property is set to true then the heading's sequence is
             * controlled automatically by Aspose.Pdf for .NET. After setting all properties, add
             * heading into the paragraphs collection of the section
             */

            Aspose.Pdf.Generator.Heading heading3 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 1);
            Aspose.Pdf.Generator.Segment segment3 = new Aspose.Pdf.Generator.Segment(heading3);
            heading3.Segments.Add(segment3);
            segment3.Content        = "RomanLower";
            heading3.HeadingType    = Aspose.Pdf.Generator.HeadingType.RomanLower;
            heading3.IsAutoSequence = true;
            sec1.Paragraphs.Add(heading3);

            /*
             * Create 4th heading in the Pdf object's section with level=1. Then create a
             * text segment and add it in the heading. Set its numbering style to "EnglishUpper"
             * using HeadingType enumeration. And don't forget to set IsAutoSequence=true.
             * If IsAutoSeguence property is set to true then the heading's sequence is
             * controlled automatically by Aspose.Pdf for .NET. After setting all properties, add
             * heading into the paragraphs collection of the section
             */

            Aspose.Pdf.Generator.Heading heading4 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 1);
            Aspose.Pdf.Generator.Segment segment4 = new Aspose.Pdf.Generator.Segment(heading4);
            heading4.Segments.Add(segment4);
            segment4.Content        = "EnglishUpper";
            heading4.HeadingType    = Aspose.Pdf.Generator.HeadingType.EnglishUpper;
            heading4.IsAutoSequence = true;
            sec1.Paragraphs.Add(heading4);

            /*
             * Create 5th heading in the Pdf object's section with level=1. Then create a
             * text segment and add it in the heading. Set its numbering style to "EnglishLower"
             * using HeadingType enumeration. And don't forget to set IsAutoSequence=true.
             * If IsAutoSeguence property is set to true then the heading's sequence is
             * controlled automatically by Aspose.Pdf for .NET. After setting all properties, add
             * heading into the paragraphs collection of the section
             */

            Aspose.Pdf.Generator.Heading heading5 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 1);
            Aspose.Pdf.Generator.Segment segment5 = new Aspose.Pdf.Generator.Segment(heading5);
            heading5.Segments.Add(segment5);
            segment5.Content        = "EnglishLower";
            heading5.HeadingType    = Aspose.Pdf.Generator.HeadingType.EnglishLower;
            heading5.IsAutoSequence = true;
            sec1.Paragraphs.Add(heading5);
            pdf1.Save(dataDir + "headings_out.pdf");
            // ExEnd:ApplyingNumber
        }
        public static void Run()
        {
            // ExStart:SpecifyHeadingLevel
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Headings();

            // Instntiate the Pdf object by calling its empty constructor
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

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

            /*
             * Create 1st heading in the Pdf object's section with level=1. Then create
             * a text segment and add it in the heading. Set its StartNumber=6 to start
             * the numbering from 6 and onwards. And don't forget to set IsAutoSequence=true.
             * If IsAutoSeguence property is set to true then the heading's sequence is
             * controlled automatically by Aspose.Pdf for .NET. After setting all properties, add
             * heading into the paragraphs collection of the section
             */

            Aspose.Pdf.Generator.Heading heading1 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 1);
            Aspose.Pdf.Generator.Segment segment1 = new Aspose.Pdf.Generator.Segment(heading1);
            heading1.Segments.Add(segment1);
            segment1.Content        = "Level 1";
            heading1.IsAutoSequence = true;
            heading1.StartNumber    = 6;
            sec1.Paragraphs.Add(heading1);

            /*
             * Create 2nd heading in the Pdf object's section with level=2. Then create
             * a text segment and add it in the heading. And don't forget to set
             * IsAutoSequence=true.If IsAutoSeguence property is set to true then the
             * heading's sequence is controlled automatically by Aspose.Pdf for .NET. After setting
             * all properties, add heading into the paragraphs collection of the section
             */

            Aspose.Pdf.Generator.Heading heading2 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 2);
            Aspose.Pdf.Generator.Segment segment2 = new Aspose.Pdf.Generator.Segment(heading2);
            heading2.Segments.Add(segment2);
            segment2.Content        = "Level 2";
            heading2.IsAutoSequence = true;
            sec1.Paragraphs.Add(heading2);

            /*
             * Create 3rd heading in the Pdf object's section with level=3. Then create
             * a text segment and add it in the heading. And don't forget to set
             * IsAutoSequence=true.If IsAutoSeguence property is set to true then the
             * heading's sequence is controlled automatically by Aspose.Pdf for .NET. After setting
             * all properties, add heading into the paragraphs collection of the section
             */

            Aspose.Pdf.Generator.Heading heading3 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 3);
            Aspose.Pdf.Generator.Segment segment3 = new Aspose.Pdf.Generator.Segment(heading3);
            heading3.Segments.Add(segment3);
            segment3.Content        = "Level 3";
            heading3.IsAutoSequence = true;
            sec1.Paragraphs.Add(heading3);

            pdf1.Save(dataDir + "SpecifyHeadingLevel_out.pdf");
            // ExEnd:SpecifyHeadingLevel
        }
        public static void Run()
        {
            // ExStart:ApplyingNumber
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Headings();
            // Instntiate the Pdf object by calling its empty constructor
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

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

            /*
            * Create 1st heading in the Pdf object's section with level=1. Then create
            * a text segment and add it in the heading. Set its numbering style to "Arab"
            * using HeadingType enumeration. And don't forget to set IsAutoSequence=true.
            * If IsAutoSeguence property is set to true then the heading's sequence is 
            * controlled automatically by Aspose.Pdf. After setting all properties, add 
            * heading into the paragraphs collection of the section
            */

            Aspose.Pdf.Generator.Heading heading1 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 1);
            Aspose.Pdf.Generator.Segment segment1 = new Aspose.Pdf.Generator.Segment(heading1);
            heading1.Segments.Add(segment1);
            segment1.Content = "Arab";
            heading1.HeadingType = Aspose.Pdf.Generator.HeadingType.Arab;
            heading1.IsAutoSequence = true;
            sec1.Paragraphs.Add(heading1);

            /*
            * Create 2nd heading in the Pdf object's section with level=1. Then create
            * a text segment and add it in the heading. Set its numbering style to "RomanUpper"
            * using HeadingType enumeration. And don't forget to set IsAutoSequence=true.
            * If IsAutoSeguence property is set to true then the heading's sequence is 
            * controlled automatically by Aspose.Pdf for .NET. After setting all properties, add 
            * heading into the paragraphs collection of the section
            */

            Aspose.Pdf.Generator.Heading heading2 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 1);
            Aspose.Pdf.Generator.Segment segment2 = new Aspose.Pdf.Generator.Segment(heading2);
            heading2.Segments.Add(segment2);
            segment2.Content = "RomanUpper";
            heading2.HeadingType = Aspose.Pdf.Generator.HeadingType.RomanUpper;
            heading2.IsAutoSequence = true;
            sec1.Paragraphs.Add(heading2);

            /*
            * Create 3rd heading in the Pdf object's section with level=1. Then create
            * a text segment and add it in the heading. Set its numbering style to "RomanLower"
            * using HeadingType enumeration. And don't forget to set IsAutoSequence=true.
            * If IsAutoSeguence property is set to true then the heading's sequence is 
            * controlled automatically by Aspose.Pdf for .NET. After setting all properties, add 
            * heading into the paragraphs collection of the section
            */

            Aspose.Pdf.Generator.Heading heading3 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 1);
            Aspose.Pdf.Generator.Segment segment3 = new Aspose.Pdf.Generator.Segment(heading3);
            heading3.Segments.Add(segment3);
            segment3.Content = "RomanLower";
            heading3.HeadingType = Aspose.Pdf.Generator.HeadingType.RomanLower;
            heading3.IsAutoSequence = true;
            sec1.Paragraphs.Add(heading3);

            /*
            * Create 4th heading in the Pdf object's section with level=1. Then create a
            * text segment and add it in the heading. Set its numbering style to "EnglishUpper"
            * using HeadingType enumeration. And don't forget to set IsAutoSequence=true.
            * If IsAutoSeguence property is set to true then the heading's sequence is 
            * controlled automatically by Aspose.Pdf for .NET. After setting all properties, add 
            * heading into the paragraphs collection of the section
            */

            Aspose.Pdf.Generator.Heading heading4 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 1);
            Aspose.Pdf.Generator.Segment segment4 = new Aspose.Pdf.Generator.Segment(heading4);
            heading4.Segments.Add(segment4);
            segment4.Content = "EnglishUpper";
            heading4.HeadingType = Aspose.Pdf.Generator.HeadingType.EnglishUpper;
            heading4.IsAutoSequence = true;
            sec1.Paragraphs.Add(heading4);

            /*
            * Create 5th heading in the Pdf object's section with level=1. Then create a
            * text segment and add it in the heading. Set its numbering style to "EnglishLower"
            * using HeadingType enumeration. And don't forget to set IsAutoSequence=true.
            * If IsAutoSeguence property is set to true then the heading's sequence is 
            * controlled automatically by Aspose.Pdf for .NET. After setting all properties, add 
            * heading into the paragraphs collection of the section
            */

            Aspose.Pdf.Generator.Heading heading5 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 1);
            Aspose.Pdf.Generator.Segment segment5 = new Aspose.Pdf.Generator.Segment(heading5);
            heading5.Segments.Add(segment5);
            segment5.Content = "EnglishLower";
            heading5.HeadingType = Aspose.Pdf.Generator.HeadingType.EnglishLower;
            heading5.IsAutoSequence = true;
            sec1.Paragraphs.Add(heading5);                       
            pdf1.Save( dataDir + "headings_out.pdf");            
            // ExEnd:ApplyingNumber   
                
        }
        public static void Run()
        {
            // ExStart:ChangeTextFormat
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Text();
           
            // Instantiate Pdf instance by calling its empty constructor
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

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

            // Set text color to blue in the whole section 
            sec1.TextInfo.Color = new Aspose.Pdf.Generator.Color("Blue");

            // Add 1st paragraph (inheriting the text format settings from the section)
            // To the section 
            sec1.Paragraphs.Add(new Aspose.Pdf.Generator.Text(sec1, "paragraph 1 "));

            // Add 2nd paragraph (inheriting the text format settings from the section)
            // To the section
            sec1.Paragraphs.Add(new Aspose.Pdf.Generator.Text(sec1, "paragraph 2"));

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

            // Create a segment "seg1" in the paragraph "t3"
            Aspose.Pdf.Generator.Segment seg1 = new Aspose.Pdf.Generator.Segment(t3);

            // Assign some content to the segment
            seg1.Content = "paragraph 3 segment 1";

            // Set the color of the segment to red
            seg1.TextInfo.Color = new Aspose.Pdf.Generator.Color("Red");

            // Add segment (with red text color) to the paragraph
            t3.Segments.Add(seg1);

            // Create a new segment "seg2" in the paragraph "t3"
            Aspose.Pdf.Generator.Segment seg2 = new Aspose.Pdf.Generator.Segment(t3);

            // Assign some content to the segment
            seg2.Content = "paragraph 3 segment 2";

            // Set the color of the segment to green
            seg2.TextInfo.Color = new Aspose.Pdf.Generator.Color("Green");

            // Add segment (with green text color) to the paragraph
            t3.Segments.Add(seg2);

            // Add 3rd text paragraph to the section with overridden text format settings
            sec1.Paragraphs.Add(t3);

            // Add 4th paragraph (inheriting the text format settings from the section)
            // To the section
            sec1.Paragraphs.Add(new Aspose.Pdf.Generator.Text(sec1, "paragraph 4"));

            Aspose.Pdf.Generator.TextInfo info1 = t3.TextInfo.Clone() as Aspose.Pdf.Generator.TextInfo;

            // Modify the font side to 16 pt
            info1.FontSize = 16;

            // Set TextInfo property of the text paragraph to newly cloned instance "info1"
            t3.TextInfo = info1;

            // Save the document
            pdf1.Save(dataDir + "ChangeTextFormat_out.pdf"); 
            // ExEnd:ChangeTextFormat
        }
        public static void Run()
        {
            // ExStart:ChangeTextFormat
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Text();

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

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

            // Set text color to blue in the whole section
            sec1.TextInfo.Color = new Aspose.Pdf.Generator.Color("Blue");

            // Add 1st paragraph (inheriting the text format settings from the section)
            // to the section
            sec1.Paragraphs.Add(new Aspose.Pdf.Generator.Text(sec1, "paragraph 1 "));

            // Add 2nd paragraph (inheriting the text format settings from the section)
            // to the section
            sec1.Paragraphs.Add(new Aspose.Pdf.Generator.Text(sec1, "paragraph 2"));

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

            // Create a segment "seg1" in the paragraph "t3"
            Aspose.Pdf.Generator.Segment seg1 = new Aspose.Pdf.Generator.Segment(t3);

            // Assign some content to the segment
            seg1.Content = "paragraph 3 segment 1";

            // Set the color of the segment to red
            seg1.TextInfo.Color = new Aspose.Pdf.Generator.Color("Red");

            // Add segment (with red text color) to the paragraph
            t3.Segments.Add(seg1);

            // Create a new segment "seg2" in the paragraph "t3"
            Aspose.Pdf.Generator.Segment seg2 = new Aspose.Pdf.Generator.Segment(t3);

            // Assign some content to the segment
            seg2.Content = "paragraph 3 segment 2";

            // Set the color of the segment to green
            seg2.TextInfo.Color = new Aspose.Pdf.Generator.Color("Green");

            // Add segment (with green text color) to the paragraph
            t3.Segments.Add(seg2);

            // Add 3rd text paragraph to the section with overridden text format settings
            sec1.Paragraphs.Add(t3);

            // Add 4th paragraph (inheriting the text format settings from the section)
            // to the section
            sec1.Paragraphs.Add(new Aspose.Pdf.Generator.Text(sec1, "paragraph 4"));

            Aspose.Pdf.Generator.TextInfo info1 = t3.TextInfo.Clone() as Aspose.Pdf.Generator.TextInfo;

            // Modify the font side to 16 pt
            info1.FontSize = 16;

            // Set TextInfo property of the text paragraph to newly cloned instance "info1"
            t3.TextInfo = info1;

            // Save the document
            pdf1.Save(dataDir + "ChangeTextFormat_out_.pdf");
            // ExEnd:ChangeTextFormat
        }
Exemple #41
0
        public static void Main(string[] args)
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");

            // Create directory if it is not already present.
            bool IsExists = System.IO.Directory.Exists(dataDir);

            if (!IsExists)
            {
                System.IO.Directory.CreateDirectory(dataDir);
            }

            //Instantiate Pdf instance by calling it empty constructor
            Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
            //Create a section in the Pdf object
            pdf.Sections.Add();

            pdf.IsTruetypeFontMapCached = true;
            //Specify the location where to save TruetypeFontMap.xml
            pdf.TruetypeFontMapPath = dataDir + "";

            //Create a text object and pass the string object carrying arabic text in it
            Aspose.Pdf.Generator.Text text1 = new Aspose.Pdf.Generator.Text();
            //Create a segment and add it to segments collection of text object
            Aspose.Pdf.Generator.Segment seg0 = text1.Segments.Add();
            //specify contents for segment
            seg0.Content = "أسبوز هو بائع عنصر ال";
            Aspose.Pdf.Generator.Segment seg1 = text1.Segments.Add();
            seg1.Content = ".NET";
            Aspose.Pdf.Generator.Segment seg2 = text1.Segments.Add();
            seg2.Content = "البارز";

            //Enable text alignment from right to left
            seg0.TextInfo.IsRightToLeft = true;
            seg1.TextInfo.IsRightToLeft = false;         //default
            seg2.TextInfo.IsRightToLeft = true;

            //Enable unicode character set for the text segment
            seg0.TextInfo.IsUnicode = true;
            seg1.TextInfo.IsUnicode = true;
            seg2.TextInfo.IsUnicode = true;

            //Set Font Name
            seg0.TextInfo.FontName = "Times New Roman";
            seg1.TextInfo.FontName = "Times New Roman";
            seg2.TextInfo.FontName = "Times New Roman";
            //Set font size
            seg0.TextInfo.FontSize = 14;
            seg1.TextInfo.FontSize = 14;
            seg2.TextInfo.FontSize = 14;

            //Align text to right hand side using AlignmentType enumeration
            //Make the text right aligned(The meaning of Alignment.Left and AlignmentType.Right are //exchanged when processing RTL language).
            text1.TextInfo.Alignment = Aspose.Pdf.Generator.AlignmentType.Left;

            pdf.Sections[0].Paragraphs.Add(text1);
            pdf.IsRtlInSegmentMode = true;         //default

            pdf.Save(dataDir + "AsposeOutput.pdf");
        }
        public static void Run()
        {
            // ExStart:SpecifyHeadingLevel
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfGenerator_Headings();
            // Instntiate the Pdf object by calling its empty constructor
            Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

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

            /*
             * Create 1st heading in the Pdf object's section with level=1. Then create
             * a text segment and add it in the heading. Set its StartNumber=6 to start 
             * the numbering from 6 and onwards. And don't forget to set IsAutoSequence=true.
             * If IsAutoSeguence property is set to true then the heading's sequence is 
             * controlled automatically by Aspose.Pdf for .NET. After setting all properties, add 
             * heading into the paragraphs collection of the section
             */

            Aspose.Pdf.Generator.Heading heading1 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 1);
            Aspose.Pdf.Generator.Segment segment1 = new Aspose.Pdf.Generator.Segment(heading1);
            heading1.Segments.Add(segment1);
            segment1.Content = "Level 1";
            heading1.IsAutoSequence = true;
            heading1.StartNumber = 6;
            sec1.Paragraphs.Add(heading1);

            /*
             * Create 2nd heading in the Pdf object's section with level=2. Then create
             * a text segment and add it in the heading. And don't forget to set 
             * IsAutoSequence=true.If IsAutoSeguence property is set to true then the 
             * heading's sequence is controlled automatically by Aspose.Pdf for .NET. After setting
             * all properties, add heading into the paragraphs collection of the section
             */

            Aspose.Pdf.Generator.Heading heading2 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 2);
            Aspose.Pdf.Generator.Segment segment2 = new Aspose.Pdf.Generator.Segment(heading2);
            heading2.Segments.Add(segment2);
            segment2.Content = "Level 2";
            heading2.IsAutoSequence = true;
            sec1.Paragraphs.Add(heading2);

            /*
             * Create 3rd heading in the Pdf object's section with level=3. Then create
             * a text segment and add it in the heading. And don't forget to set 
             * IsAutoSequence=true.If IsAutoSeguence property is set to true then the 
             * heading's sequence is controlled automatically by Aspose.Pdf for .NET. After setting
             * all properties, add heading into the paragraphs collection of the section
             */

            Aspose.Pdf.Generator.Heading heading3 = new Aspose.Pdf.Generator.Heading(pdf1, sec1, 3);
            Aspose.Pdf.Generator.Segment segment3 = new Aspose.Pdf.Generator.Segment(heading3);
            heading3.Segments.Add(segment3);
            segment3.Content = "Level 3";
            heading3.IsAutoSequence = true;
            sec1.Paragraphs.Add(heading3);

            pdf1.Save(dataDir + "SpecifyHeadingLevel_out.pdf");
            // ExEnd:SpecifyHeadingLevel   
                
        }