Reputation: 365
HI Im making a large table in MigraDoc and it automatically splits the table when it gets too large for on page. I have a logo in the header and my table when it goes to page 2 sits over the logo and doesnt go under. Anybody know how to make sure it goes under when it moves to additional pages?
Here is the logo code. Its just like their example in the Invoice
Image image = section.Headers.Primary.AddImage("H-Logo900x700.png");
image.Height = "2.5cm";
image.LockAspectRatio = true;
image.RelativeVertical = RelativeVertical.Line;
image.RelativeHorizontal = RelativeHorizontal.Margin;
image.Top = ShapePosition.Top;
image.Left = ShapePosition.Right;
image.WrapFormat.Style = WrapStyle.Through;
Upvotes: 13
Views: 7230
Reputation: 61
Document document = new Document();
Section section = document.AddSection();
For Header:
Section.PageSetup.TopMargin= "1cm";
// according to image height
For Footer:
Section.PageSetup.BottomMargin= "1cm";
// according to image height
Upvotes: 3
Reputation: 343
Sorry for answering delay..what ThomasH say's is correct,You should reserves space for header and footer (top and bottom margins)to prevent overlapping.Margin must be larger than the items added to the it(Header or Footer) in your case Image. If your Header (Image) is approx. 2.5cm you had to set
Section.PageSetup.TopMargin= Unit.FromCentimeter(3.0)
for Header
Section.PageSetup.BottomMargin= Unit.FromCentimeter(3.0)
for Footer
..I hope that you have add Section.
Upvotes: 24
Reputation: 21689
The PageSetup reserves space for header and footer (top and bottom margins). It's your responsibility to make the margins large enough to prevent overlapping between header and content.
Or with other words: it's a feature that header and content can overlap if you want it that way.
Upvotes: 14