views:

86

answers:

2

I have a series of images (just stored locally on disk) that I would like to print, one-per-page, possibly scaled up/down if necessary and centered.

What is the most straightforward method of doing this from a WPF application?

Is it to somehow create an XPS document and if so then how? If not, what other possibilities are there? (e.g. PrintDocument from System.Drawing?)

A: 

Today I found Open-Source .NET WPF Reporting Engine. I didn't try it, but I expect it can do images, and on home page it says it can do XPS.

zendar
Thanks for the link. The comment "This is a very early alpha version not intented to be used in production environments" scares me since we are going into beta in the near future. I will definitely keep an eye on it. The WinForms way of using PrintDocument currently seems like the easiest solution.
Jedidja
+1  A: 

You can use PrintDialog.PrintVisual to print anything that derives from System.Windows.Media.Visual, for example a System.Windows.Controls.Canvas, or a System.Windows.Controls.Image.

PrintDialog dlg = new PrintDialog();
if (dlg.ShowDialog())
{  
  dlg.PrintVisual(visualCtrl); 
}
Brian R. Bondy