Reputation: 177
Im creating a PDF-Document with MigraDoc. I added a full size "Header" to all Pages:
Image bg = section.Headers.FirstPage.AddImage(@"\\server\header.bmp");
bg.Height = "29.7cm";
bg.Width = "21cm";
bg.RelativeVertical = RelativeVertical.Page;
bg.RelativeHorizontal = RelativeHorizontal.Page;
bg.WrapFormat.Style = WrapStyle.Through;
Now i want to add Text from a Textbox to that Page:
Paragraph paragraph = section.AddParagraph();
paragraph.Format.SpaceBefore = "7.5cm";
paragraph.Format.SpaceAfter = "5";
paragraph.Format.Font.Color = Color.FromCmyk(100, 100, 100, 100);
FormattedText ft = paragraph.AddFormattedText(this.gMailItem.Body);
The problem i have is that the text Im adding could be bigger than one page is. If this happens, the text is printed over the "full size header"/stationery. Is there a way to limit the height of a Document (to force a page break)?
EDIT: Here is a picture of my problem: http://img4host.net/upload/1014244953be8611defa9.PNG
Upvotes: 0
Views: 1475
Reputation: 21689
The "client area" of the document is defined by the page size and the margins (top, bottom, left, right) and MigraDoc will add page breaks when this area is full.
I do not fully understand what the problem is, but probably you have to increase the top margin (instead of setting SpaceBefore to 7.5 cm - SpaceBefore works only at the start of the paragraph while TopMargin works for each new page).
Edit: See also:
Post in PDFsharp Forum
Upvotes: 1