public PrintDocument(Thickness margin) { PageLayout = new PrintLayout { Margin = margin, }; }
//, double headerHeight, double footerHeight) public PrintPage(PrintLayout pageLayout, Size bodySize, DataTemplate headerTemplate, DataTemplate footerTemplate) { InitializeComponent(); ChildRenderTransform = pageLayout.RenderTransform; BodySize = bodySize; //new Size(pageLayout.ContentSize.Width, pageLayout.ContentSize.Height - footerHeight - headerHeight); Height = pageLayout.Size.Height - pageLayout.Margin.Bottom - pageLayout.Margin.Top; Width = pageLayout.Size.Width - pageLayout.Margin.Left - pageLayout.Margin.Right; Margin = pageLayout.Margin; if (headerTemplate != null) { this.Header.Children.Add((UIElement) headerTemplate.LoadContent()); } if (footerTemplate != null) { this.Footer.Children.Add((UIElement) footerTemplate.LoadContent()); } }