Aspose.Pdf.Examples.CSharp.AsposePdfGenerator.TechnicalArticles.ImageAndPageNumberInHeaderFooter.UsingFloatingBox C# (CSharp) Method

UsingFloatingBox() public static method

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

            // Instantiate Pdf instance
            Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
            // Add a section into the pdf document
            Aspose.Pdf.Generator.Section section = pdf.Sections.Add();

            // Initializes a new instance of the FloatingBox class
            Aspose.Pdf.Generator.FloatingBox box1 = new Aspose.Pdf.Generator.FloatingBox(140, 80);
            // Indicate the horizontal positioning type of the floating box
            box1.BoxHorizontalPositioning = Aspose.Pdf.Generator.BoxHorizontalPositioningType.Margin;
            // Float value that indicates left position of the paragraph
            box1.Left = 2;
            // Indicate the vertical alignment type of the floating box
            box1.BoxVerticalPositioning = Aspose.Pdf.Generator.BoxVerticalPositioningType.Page;
            // Float value that indicates top position of the paragraph
            box1.Top = 10;
            // Add the macros to the paragraphs collection of the FloatingBox
            box1.Paragraphs.Add(new Aspose.Pdf.Generator.Text("Page: ($p/ $P )"));
            // Add a floatingBox to the section
            section.Paragraphs.Add(box1);

            // Save the document
            pdf.Save( dataDir + "PageNumber_using_FloatingBox_out.pdf");
            // ExEnd:UsingFloatingBox
        }
    }
ImageAndPageNumberInHeaderFooter