PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Jul 13, 2024 11:47 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Thu Nov 25, 2010 4:18 pm 
Offline

Joined: Thu Nov 25, 2010 4:04 pm
Posts: 7
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 11703 times ]


Attachment:
footer2.PNG
footer2.PNG [ 22.03 KiB | Viewed 11703 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


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 25, 2010 4:41 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
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.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 25, 2010 5:49 pm 
Offline

Joined: Thu Nov 25, 2010 4:04 pm
Posts: 7
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);


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 78 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:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group