PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Footer and text overflow with MigraDoc
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1440
Page 1 of 1

Author:  matthieugd [ Thu Nov 25, 2010 4:18 pm ]
Post subject:  Footer and text overflow with MigraDoc

Hello,

In a document even if I specify a BottomMargin my text is overlapping the footer. My document has one section and two footers (first page and the others). Here's the code:

Code:
section.PageSetup.LeftMargin = Unit.FromInch(0.8);
section.PageSetup.TopMargin = Unit.FromInch(0.4);
section.PageSetup.BottomMargin = Unit.FromCentimeter(0.8);


Code:
 var footer = cover.Footers.FirstPage.AddParagraph(Labels.Copyright);
 footer.Format.Font = new Font(FontsNames.Akkurat_Pro, new Unit(9, UnitType.Point));
 footer.AddLineBreak();
 footer.AddFormattedText(Labels.DocConfidentiel, TextFormat.Bold);


Code:
var footer = notesgenerales.Footers.Primary.AddParagraph(Labels.Copyright);
           
footer.Format.Borders.Top.Color = Colors.Black;
footer.Format.Borders.Top.Width = 1;
footer.Format.Font = new Font(FontsNames.Akku, new Unit(9, UnitType.Point));
footer.AddLineBreak();
footer.AddFormattedText(Labels.DocConfidentiel, TextFormat.Bold);

var frameNames = notesgenerales.Footers.Primary.AddTextFrame();

var names = frameNames.AddParagraph(string.Format("{0} {1} {4} {2} {3} ", report.Profile1CandidateHonourific,
                            report.Profile1CandidateName,
                            report.Profile2CandidateHonourific,
                            report.Profile2CandidateName,
                            Labels.And));
names.Format.Alignment = ParagraphAlignment.Right;
names.Format.Font = new Font(FontsNames.Akku, new Unit(9, UnitType.Point));
names.AddSpace(1);
names.AddPageField();
frameNames.RelativeHorizontal = RelativeHorizontal.Margin;
frameNames.RelativeVertical = RelativeVertical.Page;
frameNames.Left = ShapePosition.Right;
frameNames.Top = ShapePosition.Bottom;
frameNames.Width = 300;


I attached two screenshoot of the PDF generated. with two values of the BottomMargin.

Attachment:
footer1.PNG
footer1.PNG [ 21.05 KiB | Viewed 11698 times ]


Attachment:
footer2.PNG
footer2.PNG [ 22.03 KiB | Viewed 11698 times ]


Any idea what I'm doing wrong ? I have tried to specify the MarginBottom value at the Document level, Section Level, bith etc.

Matthieu

Author:  Thomas Hoevel [ Thu Nov 25, 2010 4:41 pm ]
Post subject:  Re: Footer and text overflow with MigraDoc

Salut, Matthieu!

The PageSetup.FooterDistance Property specifies the position of the footer.

The default setting "1.25cm" collides with your tiny bottom margin.
Set FooterDistance to a smaller value.

Author:  matthieugd [ Thu Nov 25, 2010 5:49 pm ]
Post subject:  Re: Footer and text overflow with MigraDoc

Thomas Hoevel wrote:
Salut, Matthieu!

The PageSetup.FooterDistance Property specifies the position of the footer.

The default setting "1.25cm" collides with your tiny bottom margin.
Set FooterDistance to a smaller value.


Merci Thomas :)

I'm afraid to not understand the way to use those two settings, FooterDistance is the distance between the edge of the page and the bottom of the footer ? So I must set a BottomMargin = FooterDistance + the height of my footer ?? But it's not seems to work that way.

Code:
document.DefaultPageSetup.BottomMargin = Unit.FromInch(2);
  document.DefaultPageSetup.FooterDistance = Unit.FromInch(0.4);

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/