/// <summary> /// Performs the layout of a single page, with header and footer generated and included as per the definition. /// Does not adjust the content size of the page /// </summary> protected void LayoutPageHeaderAndFooter() { IPDFTemplate headtemplate = this.GetCurrentHeaderTemplate(this.DocumentLayout.CurrentPageIndex); IPDFTemplate foottemplate = this.GetCurrentFooterTemplate(this.DocumentLayout.CurrentPageIndex); if (headtemplate != null) { PDFPageHeader header = new PDFPageHeader(); this.Page.AddGeneratedHeader(header, this.DocumentLayout.CurrentPageIndex); //Create the content inside the header component InstantiateTemplateForPage(header, headtemplate); Style head = header.GetAppliedStyle(); if (null != head) { this.Context.StyleStack.Push(head); } Style full = this.Context.StyleStack.GetFullStyle(header); this.DocumentLayout.CurrentPage.BeginHeader(header, full, this.Context); header.RegisterPreLayout(this.Context); this.DoLayoutAChild(header); header.RegisterLayoutComplete(this.Context); this.DocumentLayout.CurrentPage.EndHeader(); if (null != head) { this.Context.StyleStack.Pop(); } } if (foottemplate != null) { PDFPageFooter footer = new PDFPageFooter(); this.Page.AddGeneratedFooter(footer, this.DocumentLayout.CurrentPageIndex); InstantiateTemplateForPage(footer, foottemplate); Style foot = footer.GetAppliedStyle(); if (null != foot) { this.Context.StyleStack.Push(foot); } Style full = this.Context.StyleStack.GetFullStyle(footer); this.DocumentLayout.CurrentPage.BeginFooter(footer, full, this.Context); footer.RegisterPreLayout(this.Context); this.DoLayoutAChild(footer); footer.RegisterLayoutComplete(this.Context); this.DocumentLayout.CurrentPage.EndFooter(); } }
/// <summary> /// Begins the footer on the current document page /// </summary> public void BeginFooter(PDFPageFooter owner, Style full, PDFLayoutContext context) { PDFLayoutBlock block = new PDFLayoutBlock(this, owner, this.Engine, full, OverflowSplit.Never); //Take the magins away from the total bounds before initializing the regions PDFRect content = this.ContentBlock.TotalBounds; if (this.PositionOptions.Margins.IsEmpty == false) { content.Width -= this.PositionOptions.Margins.Left + this.PositionOptions.Margins.Right; content.Height -= this.PositionOptions.Margins.Top + this.PositionOptions.Margins.Bottom; } block.InitRegions(content, this.ContentBlock.Position, full.CreateColumnOptions(), context); this._footer = block; //Make this block current this.CurrentBlock = block; }