views:

169

answers:

1

I am printing a FlowDocument using flowing Code PrintDialog dialog = new PrintDialog(); var value = dialog.ShowDialog(); if (value.HasValue && value.Value == true) {

            XpsDocumentWriter writer = PrintQueue.CreateXpsDocumentWriter(dialog.PrintQueue);
            PageImageableArea imageArea = dialog.PrintQueue.GetPrintCapabilities().PageImageableArea;
            PrintTicket ticket = dialog.PrintTicket;
            if (writer != null && imageArea != null)
            {
                DocumentPaginator paginator = (doc as IDocumentPaginatorSource).DocumentPaginator;
                paginator.PageSize = new Size((double)ticket.PageMediaSize.Width, (double)ticket.PageMediaSize.Height);
                var padding = doc.PagePadding;
                doc.PagePadding = new Thickness(
                      Math.Max(imageArea.OriginWidth, padding.Left),
                      Math.Max(imageArea.OriginHeight, padding.Top),
                      Math.Max((double)ticket.PageMediaSize.Width - (double)(imageArea.OriginWidth + imageArea.ExtentWidth), padding.Right),
                      Math.Max((double)ticket.PageMediaSize.Height - (double)(imageArea.OriginHeight + imageArea.ExtentHeight), padding.Bottom));
                doc.ColumnWidth = double.PositiveInfinity;
                // Send DocumentPaginator to the printer.
                writer.Write(paginator);
            }

        }

Now i want to print seprate block of doc on different page, how can i do this ?

A: 

You can use the element or element MSDN.

Depending on what you actually want to do, you'll have to add block to the doc:

doc.AddBlocks(newblock)
Jason Harrison