PDFsharp & MigraDoc Foundation

Vertical alignment of TextFrame in Footer
Page 1 of 1

Author:  waleed [ Fri Apr 09, 2021 9:42 pm ]
Post subject:  Vertical alignment of TextFrame in Footer


I am facing an issue with placing two TextFrame in footer vertically. I have been stuck with this is for quite some times.

Here is my code.

            section.PageSetup = _document.DefaultPageSetup.Clone();
            section.PageSetup.TopMargin = "11cm";
            section.PageSetup.LeftMargin = "1.5cm";
            section.PageSetup.BottomMargin = "8cm";

            var frame1 = new TextFrame();
            frame1.RelativeVertical = RelativeVertical.Page;
            frame1.RelativeHorizontal = RelativeHorizontal.Page;
            frame1.WrapFormat.Style = WrapStyle.Through;
            frame1.WrapFormat.DistanceLeft = "2.78cm";
            frame1.WrapFormat.DistanceBottom = "1.0cm";
            frame1.Width = "2.5cm";
            frame1.Height = "1.0cm";
            frame1.LineFormat.Color = Colors.Black;           

            var frameParagraph1 = frame1.AddParagraph();
            frameParagraph1.AddText("This should be higher");
            frameParagraph1.Format.LineSpacingRule = LineSpacingRule.OnePtFive;
            var frame2 = new TextFrame();
            frame2.RelativeVertical = RelativeVertical.Page;
            frame2.RelativeHorizontal = RelativeHorizontal.Page;
            frame2.WrapFormat.Style = WrapStyle.Through;
            frame2.WrapFormat.DistanceLeft = "7.15cm";
            frame2.WrapFormat.DistanceBottom = "4.0cm";
            frame2.Width = "3.0cm";
            frame2.Height = "1.0cm";
            frame2.LineFormat.Color = Colors.Black;

            var framePragraph2 = frame2.AddParagraph();
            framePragraph2.AddText("This should be lower");



    - I did not have any issue with the header , but only with the footer.
    - The issue does not appear when i place only one text frame in the footer.
    - I noticed that the frames are positioned based on the position of the last text frame that i add.
    - Horizontal alignment works well.
    - I have read many similar issues here, none of the solutions worked form me.

screenshot.PNG [ 8.94 KiB | Viewed 373 times ]

Author:  TH-Soft [ Mon Apr 12, 2021 10:58 am ]
Post subject:  Re: Vertical alignment of TextFrame in Footer

Which version?
Does it work with "DistanceTop" instead of "DistanceBottom"?

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group