Не уверен, что вы все еще боретесь с этой проблемой, но вы можете попробовать использовать FlowDocument.
если вы напишите обертку вокруг DocumentPaginator, вы сможете вставить заголовок в потоковый документ. Также вы можете установить для flowdoc.PagePadding пользовательское значение, принимая во внимание printablePageHeight и высоту вашего размера контента.
Вот пример обёртки вокруг DocumentPaginator, который я получил из книги: Pro WPF в C # 2008 - Мэтью Макдональд
Надеюсь, это поможет. (PS. Я только что скопировал и вставил значение по умолчанию, поэтому не добавил никаких пользовательских вызовов и т. Д.)
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;
}
}
}