private void GoClick(object sender, RoutedEventArgs e) { var blockFormatterFactory = new BlockFormattersFactory(); var pm = new PrintManager(); var formatter = new SimpleFlowDocumentDataFormatter(); for (int i = 0; i < _count; i++) { string headerText = String.Format("Page {0} title", i); formatter.AppendBlocks(blockFormatterFactory.HeaderFromNewPage(headerText)); } Func<int, IBlankPage> pageFactoryMethod = pageNum => new SimpleBlankPage { Header = "Header/Footer printing sample", Footer = String.Format("Page number: {0}", pageNum+1) }; var blankPageSource = new RelayedBlankPageSource(pageFactoryMethod); var doc = new SimpleDocument(blankPageSource, formatter); pm.PrintPreview(doc); }