private void Button_Click(object sender, RoutedEventArgs e)
        {
            var blockFormatterFactory = new BlockFormattersFactory();
            var pm = new PrintManager();

            var formatter = new SimpleFlowDocumentDataFormatter();

            formatter.AppendBlocks(blockFormatterFactory.Header("Simple text sample"));
            formatter.AppendBlocks(blockFormatterFactory.Text(textBox.Text));

            var doc = new SimpleDocument(formatter);

            pm.PrintPreview(doc);
        }
        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);
        }