How to print WPF Grid paged?

I'm printing a WPF grid. As long as the data fits on one page, everything works fine. But sometimes the grid contains more data. Therefore I need to split the grid into multiple pages. Can anybody help me?

My code looks like this (visual is the grid).

var printCapabilities = printDialog.PrintQueue.GetPrintCapabilities(printDialog.PrintTicket);

var size = new Size(printCapabilities.PageImageableArea.ExtentWidth,
     printCapabilities.PageImageableArea.ExtentHeight);

visual.Measure(size);
visual.Arrange(new Rect(new Point(printCapabilities.PageImageableArea.OriginWidth,
    printCapabilities.PageImageableArea.OriginHeight), size));

printDialog.PrintVisual(visual, "Print ListView");

Should I try another control? I've tried WPF Toolkit DataGrid, but I couldn't manage to get it printed. I've heard something of a flow document, can this help me?

Best Regards Oliver Hanappi

Answers


It sounds like you want to use PrintDocument instead of PrintVisual. You will probably need to implement your own DocumentPaginator class to split your grid into separate printable documents, though.


Need Your Help

tvOS UIFocusGuide for multiple objects

swift tvos apple-tv

I'm trying to manipulate the tvOS focus engine but without succes. The setup is basic: 3 small buttons and 2 full-width collectionViews, see image.

Can 3D OpenGL game written in Python look good and run fast?

python opengl

I am planning to write an simple 3d(isometric view) game in Java using jMonkeyEngine - nothing to fancy, I just want to learn something about OpenGL and writing efficient algorithms (random map