PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 8:57 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Fri Apr 09, 2021 9:42 pm 
Offline

Joined: Fri Apr 09, 2021 9:37 pm
Posts: 1
Hi,

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.

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");

            section.Footers.Primary.Add(frame1);
            section.Footers.Primary.Add(frame2);




Notes

    - 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.


Attachments:
screenshot.PNG
screenshot.PNG [ 8.94 KiB | Viewed 2430 times ]
Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 12, 2021 10:58 am 
Offline
PDFsharp Expert
User avatar

Joined: Sat Mar 14, 2015 10:15 am
Posts: 909
Location: CCAA
Which version?
Does it work with "DistanceTop" instead of "DistanceBottom"?

_________________
Best regards
Thomas
(Freelance Software Developer with several years of MigraDoc/PDFsharp experience)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 135 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group