Hi,
Not sure if you are still battling with this issue, but you could try using FlowDocument.
if you write a wrapper around DocumentPaginator you'll be able to insert a header into the flowdoc. Also, you can set the flowdoc.PagePadding to a custom value, taking into account the printablePageHeight and the height of your content-size.
Here's an example of a wrapper around the DocumentPaginator which I got from the book : Pro WPF in C# 2008 - Mathew MacDonald
Hope it helps. (PS. I just copied and pasted the default so didn't add any custom calcs etc.)
using System.Globalization;
using System.Windows;
using System.Windows.Documents;
using System.Windows.Media;
namespace NPS.ClinicalEAudit.Controls
{
public class FlowDocPaginator : DocumentPaginator
{
private DocumentPaginator _paginator;
public FlowDocPaginator(FlowDocument flowDoc)
{
_paginator = ((IDocumentPaginatorSource) flowDoc).DocumentPaginator;
}
public override bool IsPageCountValid
{
get { return _paginator.IsPageCountValid; }
}
public override int PageCount
{
get { return _paginator.PageCount; }
}
public override Size PageSize
{
get { return _paginator.PageSize; }
set { _paginator.PageSize = value; }
}
public override IDocumentPaginatorSource Source
{
get { return _paginator.Source; }
}
public override DocumentPage GetPage(int pageNumber)
{
// Get the requested page.
DocumentPage page = _paginator.GetPage(pageNumber);
// Wrap the page in a Visual object. You can then apply transformations
// and add other elements.
ContainerVisual newVisual = new ContainerVisual();
newVisual.Children.Add(page.Visual);
// Create a header.
DrawingVisual header = new DrawingVisual();
using (DrawingContext dc = header.RenderOpen())
{
Typeface typeface = new Typeface("Times New Roman");
FormattedText text = new FormattedText("Page " +
(pageNumber + 1).ToString(), CultureInfo.CurrentCulture,
FlowDirection.LeftToRight, typeface, 14, Brushes.Black);
// Leave a quarter inch of space between the page edge and this text.
dc.DrawText(text, new Point(96 * 0.25, 96 * 0.25));
}
// Add the title to the visual.
newVisual.Children.Add(header);
// Wrap the visual in a new page.
DocumentPage newPage = new DocumentPage(newVisual);
return newPage;
}
}
}