Search code examples
c#wpfprintdialog

Printing Multiple Windows Using PrintVisual()


I'm currently using PrintVisual() in a wpf application to do printing. This is working perfectly at the moment, the only issue I now have is when processing large amounts of data I need to paginate, whereby I want to render the window multiple times to a buffer and then execute a print job. Currently PrintVisual() creates multiple print jobs, which works, but is not very eloquent.

I have attempted to use reflector to get the source for PrintVisual() in hopes of implementing that into an IDocumentPaginatorSource, unfortunately reflector is failing.

Perhaps I should try rending the window to a FlowDocument? Although I'm not too keen on having to code the printing layout.

Any suggestions? Thanks In Advance!


Solution

  • I came right by calling RenderTargetBitmap() on each page's canvas.